proteus  1.7.2
C/C++/Fortran libraries
subsurfaceTransportFunctions.c
Go to the documentation of this file.
1 /* Generated by Cython 0.28.5 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6  #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8  #error Cython requires Python 2.6+ or Python 3.3+.
9 #else
10 #define CYTHON_ABI "0_28_5"
11 #define CYTHON_FUTURE_DIVISION 0
12 #include <stddef.h>
13 #ifndef offsetof
14  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
15 #endif
16 #if !defined(WIN32) && !defined(MS_WINDOWS)
17  #ifndef __stdcall
18  #define __stdcall
19  #endif
20  #ifndef __cdecl
21  #define __cdecl
22  #endif
23  #ifndef __fastcall
24  #define __fastcall
25  #endif
26 #endif
27 #ifndef DL_IMPORT
28  #define DL_IMPORT(t) t
29 #endif
30 #ifndef DL_EXPORT
31  #define DL_EXPORT(t) t
32 #endif
33 #define __PYX_COMMA ,
34 #ifndef HAVE_LONG_LONG
35  #if PY_VERSION_HEX >= 0x02070000
36  #define HAVE_LONG_LONG
37  #endif
38 #endif
39 #ifndef PY_LONG_LONG
40  #define PY_LONG_LONG LONG_LONG
41 #endif
42 #ifndef Py_HUGE_VAL
43  #define Py_HUGE_VAL HUGE_VAL
44 #endif
45 #ifdef PYPY_VERSION
46  #define CYTHON_COMPILING_IN_PYPY 1
47  #define CYTHON_COMPILING_IN_PYSTON 0
48  #define CYTHON_COMPILING_IN_CPYTHON 0
49  #undef CYTHON_USE_TYPE_SLOTS
50  #define CYTHON_USE_TYPE_SLOTS 0
51  #undef CYTHON_USE_PYTYPE_LOOKUP
52  #define CYTHON_USE_PYTYPE_LOOKUP 0
53  #if PY_VERSION_HEX < 0x03050000
54  #undef CYTHON_USE_ASYNC_SLOTS
55  #define CYTHON_USE_ASYNC_SLOTS 0
56  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
57  #define CYTHON_USE_ASYNC_SLOTS 1
58  #endif
59  #undef CYTHON_USE_PYLIST_INTERNALS
60  #define CYTHON_USE_PYLIST_INTERNALS 0
61  #undef CYTHON_USE_UNICODE_INTERNALS
62  #define CYTHON_USE_UNICODE_INTERNALS 0
63  #undef CYTHON_USE_UNICODE_WRITER
64  #define CYTHON_USE_UNICODE_WRITER 0
65  #undef CYTHON_USE_PYLONG_INTERNALS
66  #define CYTHON_USE_PYLONG_INTERNALS 0
67  #undef CYTHON_AVOID_BORROWED_REFS
68  #define CYTHON_AVOID_BORROWED_REFS 1
69  #undef CYTHON_ASSUME_SAFE_MACROS
70  #define CYTHON_ASSUME_SAFE_MACROS 0
71  #undef CYTHON_UNPACK_METHODS
72  #define CYTHON_UNPACK_METHODS 0
73  #undef CYTHON_FAST_THREAD_STATE
74  #define CYTHON_FAST_THREAD_STATE 0
75  #undef CYTHON_FAST_PYCALL
76  #define CYTHON_FAST_PYCALL 0
77  #undef CYTHON_PEP489_MULTI_PHASE_INIT
78  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
79  #undef CYTHON_USE_TP_FINALIZE
80  #define CYTHON_USE_TP_FINALIZE 0
81 #elif defined(PYSTON_VERSION)
82  #define CYTHON_COMPILING_IN_PYPY 0
83  #define CYTHON_COMPILING_IN_PYSTON 1
84  #define CYTHON_COMPILING_IN_CPYTHON 0
85  #ifndef CYTHON_USE_TYPE_SLOTS
86  #define CYTHON_USE_TYPE_SLOTS 1
87  #endif
88  #undef CYTHON_USE_PYTYPE_LOOKUP
89  #define CYTHON_USE_PYTYPE_LOOKUP 0
90  #undef CYTHON_USE_ASYNC_SLOTS
91  #define CYTHON_USE_ASYNC_SLOTS 0
92  #undef CYTHON_USE_PYLIST_INTERNALS
93  #define CYTHON_USE_PYLIST_INTERNALS 0
94  #ifndef CYTHON_USE_UNICODE_INTERNALS
95  #define CYTHON_USE_UNICODE_INTERNALS 1
96  #endif
97  #undef CYTHON_USE_UNICODE_WRITER
98  #define CYTHON_USE_UNICODE_WRITER 0
99  #undef CYTHON_USE_PYLONG_INTERNALS
100  #define CYTHON_USE_PYLONG_INTERNALS 0
101  #ifndef CYTHON_AVOID_BORROWED_REFS
102  #define CYTHON_AVOID_BORROWED_REFS 0
103  #endif
104  #ifndef CYTHON_ASSUME_SAFE_MACROS
105  #define CYTHON_ASSUME_SAFE_MACROS 1
106  #endif
107  #ifndef CYTHON_UNPACK_METHODS
108  #define CYTHON_UNPACK_METHODS 1
109  #endif
110  #undef CYTHON_FAST_THREAD_STATE
111  #define CYTHON_FAST_THREAD_STATE 0
112  #undef CYTHON_FAST_PYCALL
113  #define CYTHON_FAST_PYCALL 0
114  #undef CYTHON_PEP489_MULTI_PHASE_INIT
115  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
116  #undef CYTHON_USE_TP_FINALIZE
117  #define CYTHON_USE_TP_FINALIZE 0
118 #else
119  #define CYTHON_COMPILING_IN_PYPY 0
120  #define CYTHON_COMPILING_IN_PYSTON 0
121  #define CYTHON_COMPILING_IN_CPYTHON 1
122  #ifndef CYTHON_USE_TYPE_SLOTS
123  #define CYTHON_USE_TYPE_SLOTS 1
124  #endif
125  #if PY_VERSION_HEX < 0x02070000
126  #undef CYTHON_USE_PYTYPE_LOOKUP
127  #define CYTHON_USE_PYTYPE_LOOKUP 0
128  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
129  #define CYTHON_USE_PYTYPE_LOOKUP 1
130  #endif
131  #if PY_MAJOR_VERSION < 3
132  #undef CYTHON_USE_ASYNC_SLOTS
133  #define CYTHON_USE_ASYNC_SLOTS 0
134  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
135  #define CYTHON_USE_ASYNC_SLOTS 1
136  #endif
137  #if PY_VERSION_HEX < 0x02070000
138  #undef CYTHON_USE_PYLONG_INTERNALS
139  #define CYTHON_USE_PYLONG_INTERNALS 0
140  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
141  #define CYTHON_USE_PYLONG_INTERNALS 1
142  #endif
143  #ifndef CYTHON_USE_PYLIST_INTERNALS
144  #define CYTHON_USE_PYLIST_INTERNALS 1
145  #endif
146  #ifndef CYTHON_USE_UNICODE_INTERNALS
147  #define CYTHON_USE_UNICODE_INTERNALS 1
148  #endif
149  #if PY_VERSION_HEX < 0x030300F0
150  #undef CYTHON_USE_UNICODE_WRITER
151  #define CYTHON_USE_UNICODE_WRITER 0
152  #elif !defined(CYTHON_USE_UNICODE_WRITER)
153  #define CYTHON_USE_UNICODE_WRITER 1
154  #endif
155  #ifndef CYTHON_AVOID_BORROWED_REFS
156  #define CYTHON_AVOID_BORROWED_REFS 0
157  #endif
158  #ifndef CYTHON_ASSUME_SAFE_MACROS
159  #define CYTHON_ASSUME_SAFE_MACROS 1
160  #endif
161  #ifndef CYTHON_UNPACK_METHODS
162  #define CYTHON_UNPACK_METHODS 1
163  #endif
164  #ifndef CYTHON_FAST_THREAD_STATE
165  #define CYTHON_FAST_THREAD_STATE 1
166  #endif
167  #ifndef CYTHON_FAST_PYCALL
168  #define CYTHON_FAST_PYCALL 1
169  #endif
170  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
171  #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000)
172  #endif
173  #ifndef CYTHON_USE_TP_FINALIZE
174  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
175  #endif
176 #endif
177 #if !defined(CYTHON_FAST_PYCCALL)
178 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
179 #endif
180 #if CYTHON_USE_PYLONG_INTERNALS
181  #include "longintrepr.h"
182  #undef SHIFT
183  #undef BASE
184  #undef MASK
185 #endif
186 #ifndef __has_attribute
187  #define __has_attribute(x) 0
188 #endif
189 #ifndef __has_cpp_attribute
190  #define __has_cpp_attribute(x) 0
191 #endif
192 #ifndef CYTHON_RESTRICT
193  #if defined(__GNUC__)
194  #define CYTHON_RESTRICT __restrict__
195  #elif defined(_MSC_VER) && _MSC_VER >= 1400
196  #define CYTHON_RESTRICT __restrict
197  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
198  #define CYTHON_RESTRICT restrict
199  #else
200  #define CYTHON_RESTRICT
201  #endif
202 #endif
203 #ifndef CYTHON_UNUSED
204 # if defined(__GNUC__)
205 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
206 # define CYTHON_UNUSED __attribute__ ((__unused__))
207 # else
208 # define CYTHON_UNUSED
209 # endif
210 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
211 # define CYTHON_UNUSED __attribute__ ((__unused__))
212 # else
213 # define CYTHON_UNUSED
214 # endif
215 #endif
216 #ifndef CYTHON_MAYBE_UNUSED_VAR
217 # if defined(__cplusplus)
218  template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
219 # else
220 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
221 # endif
222 #endif
223 #ifndef CYTHON_NCP_UNUSED
224 # if CYTHON_COMPILING_IN_CPYTHON
225 # define CYTHON_NCP_UNUSED
226 # else
227 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
228 # endif
229 #endif
230 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
231 #ifdef _MSC_VER
232  #ifndef _MSC_STDINT_H_
233  #if _MSC_VER < 1300
234  typedef unsigned char uint8_t;
235  typedef unsigned int uint32_t;
236  #else
237  typedef unsigned __int8 uint8_t;
238  typedef unsigned __int32 uint32_t;
239  #endif
240  #endif
241 #else
242  #include <stdint.h>
243 #endif
244 #ifndef CYTHON_FALLTHROUGH
245  #if defined(__cplusplus) && __cplusplus >= 201103L
246  #if __has_cpp_attribute(fallthrough)
247  #define CYTHON_FALLTHROUGH [[fallthrough]]
248  #elif __has_cpp_attribute(clang::fallthrough)
249  #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
250  #elif __has_cpp_attribute(gnu::fallthrough)
251  #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
252  #endif
253  #endif
254  #ifndef CYTHON_FALLTHROUGH
255  #if __has_attribute(fallthrough)
256  #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
257  #else
258  #define CYTHON_FALLTHROUGH
259  #endif
260  #endif
261  #if defined(__clang__ ) && defined(__apple_build_version__)
262  #if __apple_build_version__ < 7000000
263  #undef CYTHON_FALLTHROUGH
264  #define CYTHON_FALLTHROUGH
265  #endif
266  #endif
267 #endif
268 
269 #ifndef CYTHON_INLINE
270  #if defined(__clang__)
271  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
272  #elif defined(__GNUC__)
273  #define CYTHON_INLINE __inline__
274  #elif defined(_MSC_VER)
275  #define CYTHON_INLINE __inline
276  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
277  #define CYTHON_INLINE inline
278  #else
279  #define CYTHON_INLINE
280  #endif
281 #endif
282 
283 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
284  #define Py_OptimizeFlag 0
285 #endif
286 #define __PYX_BUILD_PY_SSIZE_T "n"
287 #define CYTHON_FORMAT_SSIZE_T "z"
288 #if PY_MAJOR_VERSION < 3
289  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
290  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
291  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
292  #define __Pyx_DefaultClassType PyClass_Type
293 #else
294  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
295  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
296  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
297  #define __Pyx_DefaultClassType PyType_Type
298 #endif
299 #ifndef Py_TPFLAGS_CHECKTYPES
300  #define Py_TPFLAGS_CHECKTYPES 0
301 #endif
302 #ifndef Py_TPFLAGS_HAVE_INDEX
303  #define Py_TPFLAGS_HAVE_INDEX 0
304 #endif
305 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
306  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
307 #endif
308 #ifndef Py_TPFLAGS_HAVE_FINALIZE
309  #define Py_TPFLAGS_HAVE_FINALIZE 0
310 #endif
311 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
312  #ifndef METH_FASTCALL
313  #define METH_FASTCALL 0x80
314  #endif
315  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
316  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
317  Py_ssize_t nargs, PyObject *kwnames);
318 #else
319  #define __Pyx_PyCFunctionFast _PyCFunctionFast
320  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
321 #endif
322 #if CYTHON_FAST_PYCCALL
323 #define __Pyx_PyFastCFunction_Check(func)\
324  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)))))
325 #else
326 #define __Pyx_PyFastCFunction_Check(func) 0
327 #endif
328 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
329  #define PyObject_Malloc(s) PyMem_Malloc(s)
330  #define PyObject_Free(p) PyMem_Free(p)
331  #define PyObject_Realloc(p) PyMem_Realloc(p)
332 #endif
333 #if CYTHON_COMPILING_IN_PYSTON
334  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
335  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
336 #else
337  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
338  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
339 #endif
340 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
341  #define __Pyx_PyThreadState_Current PyThreadState_GET()
342 #elif PY_VERSION_HEX >= 0x03060000
343  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
344 #elif PY_VERSION_HEX >= 0x03000000
345  #define __Pyx_PyThreadState_Current PyThreadState_GET()
346 #else
347  #define __Pyx_PyThreadState_Current _PyThreadState_Current
348 #endif
349 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
350 #include "pythread.h"
351 #define Py_tss_NEEDS_INIT 0
352 typedef int Py_tss_t;
353 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
354  *key = PyThread_create_key();
355  return 0; // PyThread_create_key reports success always
356 }
357 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
358  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
359  *key = Py_tss_NEEDS_INIT;
360  return key;
361 }
362 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
363  PyObject_Free(key);
364 }
365 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
366  return *key != Py_tss_NEEDS_INIT;
367 }
368 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
369  PyThread_delete_key(*key);
370  *key = Py_tss_NEEDS_INIT;
371 }
372 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
373  return PyThread_set_key_value(*key, value);
374 }
375 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
376  return PyThread_get_key_value(*key);
377 }
378 #endif // TSS (Thread Specific Storage) API
379 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
380 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
381 #else
382 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
383 #endif
384 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
385  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
386  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
387 #else
388  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
389  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
390 #endif
391 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
392 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
393 #else
394 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
395 #endif
396 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
397  #define CYTHON_PEP393_ENABLED 1
398  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
399  0 : _PyUnicode_Ready((PyObject *)(op)))
400  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
401  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
402  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
403  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
404  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
405  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
406  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
407  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
408 #else
409  #define CYTHON_PEP393_ENABLED 0
410  #define PyUnicode_1BYTE_KIND 1
411  #define PyUnicode_2BYTE_KIND 2
412  #define PyUnicode_4BYTE_KIND 4
413  #define __Pyx_PyUnicode_READY(op) (0)
414  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
415  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
416  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
417  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
418  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
419  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
420  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
421  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
422 #endif
423 #if CYTHON_COMPILING_IN_PYPY
424  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
425  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
426 #else
427  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
428  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
429  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
430 #endif
431 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
432  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
433 #endif
434 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
435  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
436 #endif
437 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
438  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
439 #endif
440 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
441 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
442 #if PY_MAJOR_VERSION >= 3
443  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
444 #else
445  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
446 #endif
447 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
448  #define PyObject_ASCII(o) PyObject_Repr(o)
449 #endif
450 #if PY_MAJOR_VERSION >= 3
451  #define PyBaseString_Type PyUnicode_Type
452  #define PyStringObject PyUnicodeObject
453  #define PyString_Type PyUnicode_Type
454  #define PyString_Check PyUnicode_Check
455  #define PyString_CheckExact PyUnicode_CheckExact
456  #define PyObject_Unicode PyObject_Str
457 #endif
458 #if PY_MAJOR_VERSION >= 3
459  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
460  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
461 #else
462  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
463  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
464 #endif
465 #ifndef PySet_CheckExact
466  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
467 #endif
468 #if CYTHON_ASSUME_SAFE_MACROS
469  #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
470 #else
471  #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
472 #endif
473 #if PY_MAJOR_VERSION >= 3
474  #define PyIntObject PyLongObject
475  #define PyInt_Type PyLong_Type
476  #define PyInt_Check(op) PyLong_Check(op)
477  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
478  #define PyInt_FromString PyLong_FromString
479  #define PyInt_FromUnicode PyLong_FromUnicode
480  #define PyInt_FromLong PyLong_FromLong
481  #define PyInt_FromSize_t PyLong_FromSize_t
482  #define PyInt_FromSsize_t PyLong_FromSsize_t
483  #define PyInt_AsLong PyLong_AsLong
484  #define PyInt_AS_LONG PyLong_AS_LONG
485  #define PyInt_AsSsize_t PyLong_AsSsize_t
486  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
487  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
488  #define PyNumber_Int PyNumber_Long
489 #endif
490 #if PY_MAJOR_VERSION >= 3
491  #define PyBoolObject PyLongObject
492 #endif
493 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
494  #ifndef PyUnicode_InternFromString
495  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
496  #endif
497 #endif
498 #if PY_VERSION_HEX < 0x030200A4
499  typedef long Py_hash_t;
500  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
501  #define __Pyx_PyInt_AsHash_t PyInt_AsLong
502 #else
503  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
504  #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
505 #endif
506 #if PY_MAJOR_VERSION >= 3
507  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
508 #else
509  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
510 #endif
511 #if CYTHON_USE_ASYNC_SLOTS
512  #if PY_VERSION_HEX >= 0x030500B1
513  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
514  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
515  #else
516  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
517  #endif
518 #else
519  #define __Pyx_PyType_AsAsync(obj) NULL
520 #endif
521 #ifndef __Pyx_PyAsyncMethodsStruct
522  typedef struct {
523  unaryfunc am_await;
524  unaryfunc am_aiter;
525  unaryfunc am_anext;
526  } __Pyx_PyAsyncMethodsStruct;
527 #endif
528 
529 #if defined(WIN32) || defined(MS_WINDOWS)
530  #define _USE_MATH_DEFINES
531 #endif
532 #include <math.h>
533 #ifdef NAN
534 #define __PYX_NAN() ((float) NAN)
535 #else
536 static CYTHON_INLINE float __PYX_NAN() {
537  float value;
538  memset(&value, 0xFF, sizeof(value));
539  return value;
540 }
541 #endif
542 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
543 #define __Pyx_truncl trunc
544 #else
545 #define __Pyx_truncl truncl
546 #endif
547 
548 
549 #define __PYX_ERR(f_index, lineno, Ln_error) \
550 { \
551  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
552 }
553 
554 #ifndef __PYX_EXTERN_C
555  #ifdef __cplusplus
556  #define __PYX_EXTERN_C extern "C"
557  #else
558  #define __PYX_EXTERN_C extern
559  #endif
560 #endif
561 
562 #define __PYX_HAVE__subsurfaceTransportFunctions
563 #define __PYX_HAVE_API__subsurfaceTransportFunctions
564 /* Early includes */
565 #include <string.h>
566 #include <stdio.h>
567 #include "numpy/arrayobject.h"
568 #include "numpy/ufuncobject.h"
569 #include "math.h"
570 #ifdef _OPENMP
571 #include <omp.h>
572 #endif /* _OPENMP */
573 
574 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
575 #define CYTHON_WITHOUT_ASSERTIONS
576 #endif
577 
578 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
579  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
580 
581 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
582 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
583 #define __PYX_DEFAULT_STRING_ENCODING ""
584 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
585 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
586 #define __Pyx_uchar_cast(c) ((unsigned char)c)
587 #define __Pyx_long_cast(x) ((long)x)
588 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
589  (sizeof(type) < sizeof(Py_ssize_t)) ||\
590  (sizeof(type) > sizeof(Py_ssize_t) &&\
591  likely(v < (type)PY_SSIZE_T_MAX ||\
592  v == (type)PY_SSIZE_T_MAX) &&\
593  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
594  v == (type)PY_SSIZE_T_MIN))) ||\
595  (sizeof(type) == sizeof(Py_ssize_t) &&\
596  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
597  v == (type)PY_SSIZE_T_MAX))) )
598 #if defined (__cplusplus) && __cplusplus >= 201103L
599  #include <cstdlib>
600  #define __Pyx_sst_abs(value) std::abs(value)
601 #elif SIZEOF_INT >= SIZEOF_SIZE_T
602  #define __Pyx_sst_abs(value) abs(value)
603 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
604  #define __Pyx_sst_abs(value) labs(value)
605 #elif defined (_MSC_VER)
606  #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
607 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
608  #define __Pyx_sst_abs(value) llabs(value)
609 #elif defined (__GNUC__)
610  #define __Pyx_sst_abs(value) __builtin_llabs(value)
611 #else
612  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
613 #endif
614 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
615 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
616 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
617 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
618 #define __Pyx_PyBytes_FromString PyBytes_FromString
619 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
620 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
621 #if PY_MAJOR_VERSION < 3
622  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
623  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
624 #else
625  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
626  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
627 #endif
628 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
629 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
630 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
631 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
632 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
633 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
634 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
635 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
636 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
637 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
638 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
639 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
640 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
641 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
642 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
643 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
644 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
645  const Py_UNICODE *u_end = u;
646  while (*u_end++) ;
647  return (size_t)(u_end - u - 1);
648 }
649 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
650 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
651 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
652 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
653 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
654 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
655 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
656 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
657 #define __Pyx_PySequence_Tuple(obj)\
658  (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
659 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
660 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
661 #if CYTHON_ASSUME_SAFE_MACROS
662 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
663 #else
664 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
665 #endif
666 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
667 #if PY_MAJOR_VERSION >= 3
668 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
669 #else
670 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
671 #endif
672 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
673 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
674 static int __Pyx_sys_getdefaultencoding_not_ascii;
675 static int __Pyx_init_sys_getdefaultencoding_params(void) {
676  PyObject* sys;
677  PyObject* default_encoding = NULL;
678  PyObject* ascii_chars_u = NULL;
679  PyObject* ascii_chars_b = NULL;
680  const char* default_encoding_c;
681  sys = PyImport_ImportModule("sys");
682  if (!sys) goto bad;
683  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
684  Py_DECREF(sys);
685  if (!default_encoding) goto bad;
686  default_encoding_c = PyBytes_AsString(default_encoding);
687  if (!default_encoding_c) goto bad;
688  if (strcmp(default_encoding_c, "ascii") == 0) {
689  __Pyx_sys_getdefaultencoding_not_ascii = 0;
690  } else {
691  char ascii_chars[128];
692  int c;
693  for (c = 0; c < 128; c++) {
694  ascii_chars[c] = c;
695  }
696  __Pyx_sys_getdefaultencoding_not_ascii = 1;
697  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
698  if (!ascii_chars_u) goto bad;
699  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
700  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
701  PyErr_Format(
702  PyExc_ValueError,
703  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
704  default_encoding_c);
705  goto bad;
706  }
707  Py_DECREF(ascii_chars_u);
708  Py_DECREF(ascii_chars_b);
709  }
710  Py_DECREF(default_encoding);
711  return 0;
712 bad:
713  Py_XDECREF(default_encoding);
714  Py_XDECREF(ascii_chars_u);
715  Py_XDECREF(ascii_chars_b);
716  return -1;
717 }
718 #endif
719 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
720 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
721 #else
722 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
723 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
724 static char* __PYX_DEFAULT_STRING_ENCODING;
725 static int __Pyx_init_sys_getdefaultencoding_params(void) {
726  PyObject* sys;
727  PyObject* default_encoding = NULL;
728  char* default_encoding_c;
729  sys = PyImport_ImportModule("sys");
730  if (!sys) goto bad;
731  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
732  Py_DECREF(sys);
733  if (!default_encoding) goto bad;
734  default_encoding_c = PyBytes_AsString(default_encoding);
735  if (!default_encoding_c) goto bad;
736  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
737  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
738  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
739  Py_DECREF(default_encoding);
740  return 0;
741 bad:
742  Py_XDECREF(default_encoding);
743  return -1;
744 }
745 #endif
746 #endif
747 
748 
749 /* Test for GCC > 2.95 */
750 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
751  #define likely(x) __builtin_expect(!!(x), 1)
752  #define unlikely(x) __builtin_expect(!!(x), 0)
753 #else /* !__GNUC__ or GCC < 2.95 */
754  #define likely(x) (x)
755  #define unlikely(x) (x)
756 #endif /* __GNUC__ */
757 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
758 
759 static PyObject *__pyx_m = NULL;
760 static PyObject *__pyx_d;
761 static PyObject *__pyx_b;
762 static PyObject *__pyx_cython_runtime = NULL;
763 static PyObject *__pyx_empty_tuple;
764 static PyObject *__pyx_empty_bytes;
765 static PyObject *__pyx_empty_unicode;
766 static int __pyx_lineno;
767 static int __pyx_clineno = 0;
768 static const char * __pyx_cfilenm= __FILE__;
769 static const char *__pyx_filename;
770 
771 /* Header.proto */
772 #if !defined(CYTHON_CCOMPLEX)
773  #if defined(__cplusplus)
774  #define CYTHON_CCOMPLEX 1
775  #elif defined(_Complex_I)
776  #define CYTHON_CCOMPLEX 1
777  #else
778  #define CYTHON_CCOMPLEX 0
779  #endif
780 #endif
781 #if CYTHON_CCOMPLEX
782  #ifdef __cplusplus
783  #include <complex>
784  #else
785  #include <complex.h>
786  #endif
787 #endif
788 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
789  #undef _Complex_I
790  #define _Complex_I 1.0fj
791 #endif
792 
793 
794 static const char *__pyx_f[] = {
795  "proteus/subsurfaceTransportFunctions.pyx",
796  "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd",
797  "linux2/lib/python2.7/site-packages/Cython/Includes/cpython/type.pxd",
798 };
799 /* BufferFormatStructs.proto */
800 #define IS_UNSIGNED(type) (((type) -1) > 0)
801 struct __Pyx_StructField_;
802 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
803 typedef struct {
804  const char* name;
805  struct __Pyx_StructField_* fields;
806  size_t size;
807  size_t arraysize[8];
808  int ndim;
809  char typegroup;
810  char is_unsigned;
811  int flags;
812 } __Pyx_TypeInfo;
813 typedef struct __Pyx_StructField_ {
814  __Pyx_TypeInfo* type;
815  const char* name;
816  size_t offset;
817 } __Pyx_StructField;
818 typedef struct {
819  __Pyx_StructField* field;
820  size_t parent_offset;
821 } __Pyx_BufFmt_StackElem;
822 typedef struct {
823  __Pyx_StructField root;
824  __Pyx_BufFmt_StackElem* head;
825  size_t fmt_offset;
826  size_t new_count, enc_count;
827  size_t struct_alignment;
828  int is_complex;
829  char enc_type;
830  char new_packmode;
831  char enc_packmode;
832  char is_valid_array;
833 } __Pyx_BufFmt_Context;
834 
835 
836 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":730
837  * # in Cython to enable them only on the right systems.
838  *
839  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
840  * ctypedef npy_int16 int16_t
841  * ctypedef npy_int32 int32_t
842  */
843 typedef npy_int8 __pyx_t_5numpy_int8_t;
844 
845 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":731
846  *
847  * ctypedef npy_int8 int8_t
848  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
849  * ctypedef npy_int32 int32_t
850  * ctypedef npy_int64 int64_t
851  */
852 typedef npy_int16 __pyx_t_5numpy_int16_t;
853 
854 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":732
855  * ctypedef npy_int8 int8_t
856  * ctypedef npy_int16 int16_t
857  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
858  * ctypedef npy_int64 int64_t
859  * #ctypedef npy_int96 int96_t
860  */
861 typedef npy_int32 __pyx_t_5numpy_int32_t;
862 
863 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733
864  * ctypedef npy_int16 int16_t
865  * ctypedef npy_int32 int32_t
866  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
867  * #ctypedef npy_int96 int96_t
868  * #ctypedef npy_int128 int128_t
869  */
870 typedef npy_int64 __pyx_t_5numpy_int64_t;
871 
872 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":737
873  * #ctypedef npy_int128 int128_t
874  *
875  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
876  * ctypedef npy_uint16 uint16_t
877  * ctypedef npy_uint32 uint32_t
878  */
879 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
880 
881 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":738
882  *
883  * ctypedef npy_uint8 uint8_t
884  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
885  * ctypedef npy_uint32 uint32_t
886  * ctypedef npy_uint64 uint64_t
887  */
888 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
889 
890 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":739
891  * ctypedef npy_uint8 uint8_t
892  * ctypedef npy_uint16 uint16_t
893  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
894  * ctypedef npy_uint64 uint64_t
895  * #ctypedef npy_uint96 uint96_t
896  */
897 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
898 
899 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740
900  * ctypedef npy_uint16 uint16_t
901  * ctypedef npy_uint32 uint32_t
902  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
903  * #ctypedef npy_uint96 uint96_t
904  * #ctypedef npy_uint128 uint128_t
905  */
906 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
907 
908 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":744
909  * #ctypedef npy_uint128 uint128_t
910  *
911  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
912  * ctypedef npy_float64 float64_t
913  * #ctypedef npy_float80 float80_t
914  */
915 typedef npy_float32 __pyx_t_5numpy_float32_t;
916 
917 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":745
918  *
919  * ctypedef npy_float32 float32_t
920  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
921  * #ctypedef npy_float80 float80_t
922  * #ctypedef npy_float128 float128_t
923  */
924 typedef npy_float64 __pyx_t_5numpy_float64_t;
925 
926 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754
927  * # The int types are mapped a bit surprising --
928  * # numpy.int corresponds to 'l' and numpy.long to 'q'
929  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
930  * ctypedef npy_longlong long_t
931  * ctypedef npy_longlong longlong_t
932  */
933 typedef npy_long __pyx_t_5numpy_int_t;
934 
935 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":755
936  * # numpy.int corresponds to 'l' and numpy.long to 'q'
937  * ctypedef npy_long int_t
938  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
939  * ctypedef npy_longlong longlong_t
940  *
941  */
942 typedef npy_longlong __pyx_t_5numpy_long_t;
943 
944 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":756
945  * ctypedef npy_long int_t
946  * ctypedef npy_longlong long_t
947  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
948  *
949  * ctypedef npy_ulong uint_t
950  */
951 typedef npy_longlong __pyx_t_5numpy_longlong_t;
952 
953 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758
954  * ctypedef npy_longlong longlong_t
955  *
956  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
957  * ctypedef npy_ulonglong ulong_t
958  * ctypedef npy_ulonglong ulonglong_t
959  */
960 typedef npy_ulong __pyx_t_5numpy_uint_t;
961 
962 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":759
963  *
964  * ctypedef npy_ulong uint_t
965  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
966  * ctypedef npy_ulonglong ulonglong_t
967  *
968  */
969 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
970 
971 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":760
972  * ctypedef npy_ulong uint_t
973  * ctypedef npy_ulonglong ulong_t
974  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
975  *
976  * ctypedef npy_intp intp_t
977  */
978 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
979 
980 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":762
981  * ctypedef npy_ulonglong ulonglong_t
982  *
983  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
984  * ctypedef npy_uintp uintp_t
985  *
986  */
987 typedef npy_intp __pyx_t_5numpy_intp_t;
988 
989 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":763
990  *
991  * ctypedef npy_intp intp_t
992  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
993  *
994  * ctypedef npy_double float_t
995  */
996 typedef npy_uintp __pyx_t_5numpy_uintp_t;
997 
998 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765
999  * ctypedef npy_uintp uintp_t
1000  *
1001  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1002  * ctypedef npy_double double_t
1003  * ctypedef npy_longdouble longdouble_t
1004  */
1005 typedef npy_double __pyx_t_5numpy_float_t;
1006 
1007 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":766
1008  *
1009  * ctypedef npy_double float_t
1010  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1011  * ctypedef npy_longdouble longdouble_t
1012  *
1013  */
1014 typedef npy_double __pyx_t_5numpy_double_t;
1015 
1016 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":767
1017  * ctypedef npy_double float_t
1018  * ctypedef npy_double double_t
1019  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1020  *
1021  * ctypedef npy_cfloat cfloat_t
1022  */
1023 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1024 
1025 /* "subsurfaceTransportFunctions.pyx":14
1026  * cdef inline double double_min(double a, double b): return a if a <= b else b
1027  *
1028  * ctypedef numpy.double_t DTYPE_t # <<<<<<<<<<<<<<
1029  * #numpy.intc_t not in cython's numpy.pxd
1030  * ctypedef int ITYPE_t
1031  */
1032 typedef __pyx_t_5numpy_double_t __pyx_t_28subsurfaceTransportFunctions_DTYPE_t;
1033 
1034 /* "subsurfaceTransportFunctions.pyx":16
1035  * ctypedef numpy.double_t DTYPE_t
1036  * #numpy.intc_t not in cython's numpy.pxd
1037  * ctypedef int ITYPE_t # <<<<<<<<<<<<<<
1038  *
1039  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global,
1040  */
1041 typedef int __pyx_t_28subsurfaceTransportFunctions_ITYPE_t;
1042 /* Declarations.proto */
1043 #if CYTHON_CCOMPLEX
1044  #ifdef __cplusplus
1045  typedef ::std::complex< float > __pyx_t_float_complex;
1046  #else
1047  typedef float _Complex __pyx_t_float_complex;
1048  #endif
1049 #else
1050  typedef struct { float real, imag; } __pyx_t_float_complex;
1051 #endif
1052 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1053 
1054 /* Declarations.proto */
1055 #if CYTHON_CCOMPLEX
1056  #ifdef __cplusplus
1057  typedef ::std::complex< double > __pyx_t_double_complex;
1058  #else
1059  typedef double _Complex __pyx_t_double_complex;
1060  #endif
1061 #else
1062  typedef struct { double real, imag; } __pyx_t_double_complex;
1063 #endif
1064 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1065 
1066 
1067 /*--- Type declarations ---*/
1068 
1069 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":769
1070  * ctypedef npy_longdouble longdouble_t
1071  *
1072  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1073  * ctypedef npy_cdouble cdouble_t
1074  * ctypedef npy_clongdouble clongdouble_t
1075  */
1076 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1077 
1078 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
1079  *
1080  * ctypedef npy_cfloat cfloat_t
1081  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1082  * ctypedef npy_clongdouble clongdouble_t
1083  *
1084  */
1085 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1086 
1087 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771
1088  * ctypedef npy_cfloat cfloat_t
1089  * ctypedef npy_cdouble cdouble_t
1090  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1091  *
1092  * ctypedef npy_cdouble complex_t
1093  */
1094 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1095 
1096 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
1097  * ctypedef npy_clongdouble clongdouble_t
1098  *
1099  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1100  *
1101  * cdef inline object PyArray_MultiIterNew1(a):
1102  */
1103 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1104 
1105 /* --- Runtime support code (head) --- */
1106 /* Refnanny.proto */
1107 #ifndef CYTHON_REFNANNY
1108  #define CYTHON_REFNANNY 0
1109 #endif
1110 #if CYTHON_REFNANNY
1111  typedef struct {
1112  void (*INCREF)(void*, PyObject*, int);
1113  void (*DECREF)(void*, PyObject*, int);
1114  void (*GOTREF)(void*, PyObject*, int);
1115  void (*GIVEREF)(void*, PyObject*, int);
1116  void* (*SetupContext)(const char*, int, const char*);
1117  void (*FinishContext)(void**);
1118  } __Pyx_RefNannyAPIStruct;
1119  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1120  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1121  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1122 #ifdef WITH_THREAD
1123  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1124  if (acquire_gil) {\
1125  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1126  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1127  PyGILState_Release(__pyx_gilstate_save);\
1128  } else {\
1129  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1130  }
1131 #else
1132  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1133  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1134 #endif
1135  #define __Pyx_RefNannyFinishContext()\
1136  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1137  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1138  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1139  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1140  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1141  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1142  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1143  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1144  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1145 #else
1146  #define __Pyx_RefNannyDeclarations
1147  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1148  #define __Pyx_RefNannyFinishContext()
1149  #define __Pyx_INCREF(r) Py_INCREF(r)
1150  #define __Pyx_DECREF(r) Py_DECREF(r)
1151  #define __Pyx_GOTREF(r)
1152  #define __Pyx_GIVEREF(r)
1153  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1154  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1155  #define __Pyx_XGOTREF(r)
1156  #define __Pyx_XGIVEREF(r)
1157 #endif
1158 #define __Pyx_XDECREF_SET(r, v) do {\
1159  PyObject *tmp = (PyObject *) r;\
1160  r = v; __Pyx_XDECREF(tmp);\
1161  } while (0)
1162 #define __Pyx_DECREF_SET(r, v) do {\
1163  PyObject *tmp = (PyObject *) r;\
1164  r = v; __Pyx_DECREF(tmp);\
1165  } while (0)
1166 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1167 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1168 
1169 /* PyObjectGetAttrStr.proto */
1170 #if CYTHON_USE_TYPE_SLOTS
1171 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1172 #else
1173 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1174 #endif
1175 
1176 /* GetBuiltinName.proto */
1177 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1178 
1179 /* RaiseArgTupleInvalid.proto */
1180 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1181  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1182 
1183 /* RaiseDoubleKeywords.proto */
1184 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1185 
1186 /* ParseKeywords.proto */
1187 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1188  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1189  const char* function_name);
1190 
1191 /* ArgTypeTest.proto */
1192 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1193  ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1194  __Pyx__ArgTypeTest(obj, type, name, exact))
1195 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1196 
1197 /* IsLittleEndian.proto */
1198 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1199 
1200 /* BufferFormatCheck.proto */
1201 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1202 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1203  __Pyx_BufFmt_StackElem* stack,
1204  __Pyx_TypeInfo* type);
1205 
1206 /* BufferGetAndValidate.proto */
1207 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1208  ((obj == Py_None || obj == NULL) ?\
1209  (__Pyx_ZeroBuffer(buf), 0) :\
1210  __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1211 static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1212  __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1213 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1214 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1215 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1216 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1217 
1218 /* BufferIndexError.proto */
1219 static void __Pyx_RaiseBufferIndexError(int axis);
1220 
1221 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1222 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1223 /* PyThreadStateGet.proto */
1224 #if CYTHON_FAST_THREAD_STATE
1225 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1226 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1227 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1228 #else
1229 #define __Pyx_PyThreadState_declare
1230 #define __Pyx_PyThreadState_assign
1231 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1232 #endif
1233 
1234 /* PyErrFetchRestore.proto */
1235 #if CYTHON_FAST_THREAD_STATE
1236 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1237 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1238 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1239 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1240 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1241 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1242 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1243 #if CYTHON_COMPILING_IN_CPYTHON
1244 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1245 #else
1246 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1247 #endif
1248 #else
1249 #define __Pyx_PyErr_Clear() PyErr_Clear()
1250 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1251 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1252 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1253 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1254 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1255 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1256 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1257 #endif
1258 
1259 /* DictGetItem.proto */
1260 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1261 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1262 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1263  (likely(PyDict_CheckExact(obj)) ?\
1264  __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1265 #else
1266 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1267 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1268 #endif
1269 
1270 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
1271 /* GetItemInt.proto */
1272 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1273  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1274  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1275  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1276  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1277 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1278  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1279  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1280  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1281 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1282  int wraparound, int boundscheck);
1283 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1284  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1285  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1286  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1287 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1288  int wraparound, int boundscheck);
1289 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1290 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1291  int is_list, int wraparound, int boundscheck);
1292 
1293 /* ObjectGetItem.proto */
1294 #if CYTHON_USE_TYPE_SLOTS
1295 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1296 #else
1297 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1298 #endif
1299 
1300 /* PyFloatBinop.proto */
1301 #if !CYTHON_COMPILING_IN_PYPY
1302 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace);
1303 #else
1304 #define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace)\
1305  (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1306 #endif
1307 
1308 #define __Pyx_BufPtrStrided4d(type, buf, i0, s0, i1, s1, i2, s2, i3, s3) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2 + i3 * s3)
1309 /* PyFunctionFastCall.proto */
1310 #if CYTHON_FAST_PYCALL
1311 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1312  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1313 #if 1 || PY_VERSION_HEX < 0x030600B1
1314 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
1315 #else
1316 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1317 #endif
1318 #endif
1319 
1320 /* PyCFunctionFastCall.proto */
1321 #if CYTHON_FAST_PYCCALL
1322 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1323 #else
1324 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1325 #endif
1326 
1327 /* PyObjectCall.proto */
1328 #if CYTHON_COMPILING_IN_CPYTHON
1329 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1330 #else
1331 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1332 #endif
1333 
1334 /* GetModuleGlobalName.proto */
1335 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
1336 
1337 /* ExtTypeTest.proto */
1338 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1339 
1340 /* PyObjectCallMethO.proto */
1341 #if CYTHON_COMPILING_IN_CPYTHON
1342 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1343 #endif
1344 
1345 /* PyObjectCallOneArg.proto */
1346 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1347 
1348 /* pyobject_as_double.proto */
1349 static double __Pyx__PyObject_AsDouble(PyObject* obj);
1350 #if CYTHON_COMPILING_IN_PYPY
1351 #define __Pyx_PyObject_AsDouble(obj)\
1352 (likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
1353  likely(PyInt_CheckExact(obj)) ?\
1354  PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
1355 #else
1356 #define __Pyx_PyObject_AsDouble(obj)\
1357 ((likely(PyFloat_CheckExact(obj))) ?\
1358  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
1359 #endif
1360 
1361 /* RaiseException.proto */
1362 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1363 
1364 /* RaiseTooManyValuesToUnpack.proto */
1365 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1366 
1367 /* RaiseNeedMoreValuesToUnpack.proto */
1368 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1369 
1370 /* RaiseNoneIterError.proto */
1371 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1372 
1373 /* SaveResetException.proto */
1374 #if CYTHON_FAST_THREAD_STATE
1375 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1376 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1377 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1378 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1379 #else
1380 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1381 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1382 #endif
1383 
1384 /* PyErrExceptionMatches.proto */
1385 #if CYTHON_FAST_THREAD_STATE
1386 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1387 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1388 #else
1389 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1390 #endif
1391 
1392 /* GetException.proto */
1393 #if CYTHON_FAST_THREAD_STATE
1394 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1395 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1396 #else
1397 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1398 #endif
1399 
1400 /* Import.proto */
1401 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1402 
1403 /* CLineInTraceback.proto */
1404 #ifdef CYTHON_CLINE_IN_TRACEBACK
1405 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1406 #else
1407 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1408 #endif
1409 
1410 /* CodeObjectCache.proto */
1411 typedef struct {
1412  PyCodeObject* code_object;
1413  int code_line;
1414 } __Pyx_CodeObjectCacheEntry;
1415 struct __Pyx_CodeObjectCache {
1416  int count;
1417  int max_count;
1418  __Pyx_CodeObjectCacheEntry* entries;
1419 };
1420 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1421 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1422 static PyCodeObject *__pyx_find_code_object(int code_line);
1423 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1424 
1425 /* AddTraceback.proto */
1426 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1427  int py_line, const char *filename);
1428 
1429 /* BufferStructDeclare.proto */
1430 typedef struct {
1431  Py_ssize_t shape, strides, suboffsets;
1432 } __Pyx_Buf_DimInfo;
1433 typedef struct {
1434  size_t refcount;
1435  Py_buffer pybuffer;
1436 } __Pyx_Buffer;
1437 typedef struct {
1438  __Pyx_Buffer *rcbuffer;
1439  char *data;
1440  __Pyx_Buf_DimInfo diminfo[8];
1441 } __Pyx_LocalBuf_ND;
1442 
1443 #if PY_MAJOR_VERSION < 3
1444  static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1445  static void __Pyx_ReleaseBuffer(Py_buffer *view);
1446 #else
1447  #define __Pyx_GetBuffer PyObject_GetBuffer
1448  #define __Pyx_ReleaseBuffer PyBuffer_Release
1449 #endif
1450 
1451 
1452 /* CIntToPy.proto */
1453 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1454 
1455 /* CIntToPy.proto */
1456 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
1457 
1458 /* CIntToPy.proto */
1459 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1460 
1461 /* RealImag.proto */
1462 #if CYTHON_CCOMPLEX
1463  #ifdef __cplusplus
1464  #define __Pyx_CREAL(z) ((z).real())
1465  #define __Pyx_CIMAG(z) ((z).imag())
1466  #else
1467  #define __Pyx_CREAL(z) (__real__(z))
1468  #define __Pyx_CIMAG(z) (__imag__(z))
1469  #endif
1470 #else
1471  #define __Pyx_CREAL(z) ((z).real)
1472  #define __Pyx_CIMAG(z) ((z).imag)
1473 #endif
1474 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1475  && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1476  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1477  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1478 #else
1479  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1480  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1481 #endif
1482 
1483 /* Arithmetic.proto */
1484 #if CYTHON_CCOMPLEX
1485  #define __Pyx_c_eq_float(a, b) ((a)==(b))
1486  #define __Pyx_c_sum_float(a, b) ((a)+(b))
1487  #define __Pyx_c_diff_float(a, b) ((a)-(b))
1488  #define __Pyx_c_prod_float(a, b) ((a)*(b))
1489  #define __Pyx_c_quot_float(a, b) ((a)/(b))
1490  #define __Pyx_c_neg_float(a) (-(a))
1491  #ifdef __cplusplus
1492  #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1493  #define __Pyx_c_conj_float(z) (::std::conj(z))
1494  #if 1
1495  #define __Pyx_c_abs_float(z) (::std::abs(z))
1496  #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1497  #endif
1498  #else
1499  #define __Pyx_c_is_zero_float(z) ((z)==0)
1500  #define __Pyx_c_conj_float(z) (conjf(z))
1501  #if 1
1502  #define __Pyx_c_abs_float(z) (cabsf(z))
1503  #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1504  #endif
1505  #endif
1506 #else
1507  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1508  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1509  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1510  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1511  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1512  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1513  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1514  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1515  #if 1
1516  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1517  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1518  #endif
1519 #endif
1520 
1521 /* Arithmetic.proto */
1522 #if CYTHON_CCOMPLEX
1523  #define __Pyx_c_eq_double(a, b) ((a)==(b))
1524  #define __Pyx_c_sum_double(a, b) ((a)+(b))
1525  #define __Pyx_c_diff_double(a, b) ((a)-(b))
1526  #define __Pyx_c_prod_double(a, b) ((a)*(b))
1527  #define __Pyx_c_quot_double(a, b) ((a)/(b))
1528  #define __Pyx_c_neg_double(a) (-(a))
1529  #ifdef __cplusplus
1530  #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1531  #define __Pyx_c_conj_double(z) (::std::conj(z))
1532  #if 1
1533  #define __Pyx_c_abs_double(z) (::std::abs(z))
1534  #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1535  #endif
1536  #else
1537  #define __Pyx_c_is_zero_double(z) ((z)==0)
1538  #define __Pyx_c_conj_double(z) (conj(z))
1539  #if 1
1540  #define __Pyx_c_abs_double(z) (cabs(z))
1541  #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1542  #endif
1543  #endif
1544 #else
1545  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1546  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1547  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1548  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1549  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1550  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1551  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1552  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1553  #if 1
1554  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1555  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1556  #endif
1557 #endif
1558 
1559 /* CIntToPy.proto */
1560 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1561 
1562 /* CIntFromPy.proto */
1563 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1564 
1565 /* CIntFromPy.proto */
1566 static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *);
1567 
1568 /* CIntFromPy.proto */
1569 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1570 
1571 /* FastTypeChecks.proto */
1572 #if CYTHON_COMPILING_IN_CPYTHON
1573 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1574 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1575 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1576 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1577 #else
1578 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1579 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1580 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1581 #endif
1582 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1583 
1584 /* CheckBinaryVersion.proto */
1585 static int __Pyx_check_binary_version(void);
1586 
1587 /* PyIdentifierFromString.proto */
1588 #if !defined(__Pyx_PyIdentifier_FromString)
1589 #if PY_MAJOR_VERSION < 3
1590  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
1591 #else
1592  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
1593 #endif
1594 #endif
1595 
1596 /* ModuleImport.proto */
1597 static PyObject *__Pyx_ImportModule(const char *name);
1598 
1599 /* TypeImport.proto */
1600 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
1601 
1602 /* InitStrings.proto */
1603 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1604 
1605 
1606 /* Module declarations from 'cpython.buffer' */
1607 
1608 /* Module declarations from 'libc.string' */
1609 
1610 /* Module declarations from 'libc.stdio' */
1611 
1612 /* Module declarations from '__builtin__' */
1613 
1614 /* Module declarations from 'cpython.type' */
1615 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1616 
1617 /* Module declarations from 'cpython' */
1618 
1619 /* Module declarations from 'cpython.object' */
1620 
1621 /* Module declarations from 'cpython.ref' */
1622 
1623 /* Module declarations from 'cpython.mem' */
1624 
1625 /* Module declarations from 'numpy' */
1626 
1627 /* Module declarations from 'numpy' */
1628 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1629 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1630 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1631 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1632 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1633 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1634 
1635 /* Module declarations from 'subsurfaceTransportFunctions' */
1636 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t = { "ITYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), 0 };
1637 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
1638 #define __Pyx_MODULE_NAME "subsurfaceTransportFunctions"
1639 extern int __pyx_module_is_main_subsurfaceTransportFunctions;
1640 int __pyx_module_is_main_subsurfaceTransportFunctions = 0;
1641 
1642 /* Implementation of 'subsurfaceTransportFunctions' */
1643 static PyObject *__pyx_builtin_range;
1644 static PyObject *__pyx_builtin_ValueError;
1645 static PyObject *__pyx_builtin_RuntimeError;
1646 static PyObject *__pyx_builtin_ImportError;
1647 static const char __pyx_k_I[] = "I";
1648 static const char __pyx_k_J[] = "J";
1649 static const char __pyx_k_d[] = "d";
1650 static const char __pyx_k_i[] = "i";
1651 static const char __pyx_k_j[] = "j";
1652 static const char __pyx_k_k[] = "k";
1653 static const char __pyx_k_m[] = "m";
1654 static const char __pyx_k_n[] = "n";
1655 static const char __pyx_k_q[] = "q";
1656 static const char __pyx_k_t[] = "t";
1657 static const char __pyx_k_v[] = "v";
1658 static const char __pyx_k_w[] = "w";
1659 static const char __pyx_k_x[] = "x";
1660 static const char __pyx_k_dS[] = "dS";
1661 static const char __pyx_k_dV[] = "dV";
1662 static const char __pyx_k_df[] = "df";
1663 static const char __pyx_k_dm[] = "dm";
1664 static const char __pyx_k_eN[] = "eN";
1665 static const char __pyx_k_ii[] = "ii";
1666 static const char __pyx_k_kb[] = "kb";
1667 static const char __pyx_k_mt[] = "mt";
1668 static const char __pyx_k_nd[] = "nd";
1669 static const char __pyx_k_pi[] = "pi";
1670 static const char __pyx_k_xc[] = "xc";
1671 static const char __pyx_k_yc[] = "yc";
1672 static const char __pyx_k_KWr[] = "KWr";
1673 static const char __pyx_k_KWs[] = "KWs";
1674 static const char __pyx_k_dmt[] = "dmt";
1675 static const char __pyx_k_dot[] = "dot";
1676 static const char __pyx_k_ebN[] = "ebN";
1677 static const char __pyx_k_l2g[] = "l2g";
1678 static const char __pyx_k_nnz[] = "nnz";
1679 static const char __pyx_k_q_m[] = "q_m";
1680 static const char __pyx_k_q_r[] = "q_r";
1681 static const char __pyx_k_q_u[] = "q_u";
1682 static const char __pyx_k_q_x[] = "q_x";
1683 static const char __pyx_k_rho[] = "rho";
1684 static const char __pyx_k_sum[] = "sum";
1685 static const char __pyx_k_u_j[] = "u_j";
1686 static const char __pyx_k_vol[] = "vol";
1687 static const char __pyx_k_a_eN[] = "a_eN";
1688 static const char __pyx_k_a_up[] = "a_up";
1689 static const char __pyx_k_beta[] = "beta";
1690 static const char __pyx_k_ebNE[] = "ebNE";
1691 static const char __pyx_k_f_up[] = "f_up";
1692 static const char __pyx_k_flat[] = "flat";
1693 static const char __pyx_k_flux[] = "flux";
1694 static const char __pyx_k_main[] = "__main__";
1695 static const char __pyx_k_one8[] = "one8";
1696 static const char __pyx_k_psiC[] = "psiC";
1697 static const char __pyx_k_q_dm[] = "q_dm";
1698 static const char __pyx_k_q_kr[] = "q_kr";
1699 static const char __pyx_k_q_mt[] = "q_mt";
1700 static const char __pyx_k_rho2[] = "rho2";
1701 static const char __pyx_k_rhom[] = "rhom";
1702 static const char __pyx_k_sBar[] = "sBar";
1703 static const char __pyx_k_test[] = "__test__";
1704 static const char __pyx_k_u_eN[] = "u_eN";
1705 static const char __pyx_k_vBar[] = "vBar";
1706 static const char __pyx_k_a_avg[] = "a_avg";
1707 static const char __pyx_k_alpha[] = "alpha";
1708 static const char __pyx_k_clock[] = "clock";
1709 static const char __pyx_k_denom[] = "denom";
1710 static const char __pyx_k_drhom[] = "drhom";
1711 static const char __pyx_k_kr_eN[] = "kr_eN";
1712 static const char __pyx_k_matID[] = "matID";
1713 static const char __pyx_k_numer[] = "numer";
1714 static const char __pyx_k_numpy[] = "numpy";
1715 static const char __pyx_k_pcBar[] = "pcBar";
1716 static const char __pyx_k_q_dkr[] = "q_dkr";
1717 static const char __pyx_k_q_dmt[] = "q_dmt";
1718 static const char __pyx_k_range[] = "range";
1719 static const char __pyx_k_shape[] = "shape";
1720 static const char __pyx_k_u_dof[] = "u_dof";
1721 static const char __pyx_k_u_l2g[] = "u_l2g";
1722 static const char __pyx_k_vBar2[] = "vBar2";
1723 static const char __pyx_k_vol_e[] = "vol_e";
1724 static const char __pyx_k_zeros[] = "zeros";
1725 static const char __pyx_k_a_neig[] = "a_neig";
1726 static const char __pyx_k_colind[] = "colind";
1727 static const char __pyx_k_dkr_up[] = "dkr_up";
1728 static const char __pyx_k_import[] = "__import__";
1729 static const char __pyx_k_mt_avg[] = "mt_avg";
1730 static const char __pyx_k_nSpace[] = "nSpace";
1731 static const char __pyx_k_phi_eN[] = "phi_eN";
1732 static const char __pyx_k_picard[] = "picard";
1733 static const char __pyx_k_q_alin[] = "q_alin";
1734 static const char __pyx_k_q_detJ[] = "q_detJ";
1735 static const char __pyx_k_q_flin[] = "q_flin";
1736 static const char __pyx_k_q_mass[] = "q_mass";
1737 static const char __pyx_k_q_vals[] = "q_vals";
1738 static const char __pyx_k_rowptr[] = "rowptr";
1739 static const char __pyx_k_thetaR[] = "thetaR";
1740 static const char __pyx_k_thetaS[] = "thetaS";
1741 static const char __pyx_k_thetaW[] = "thetaW";
1742 static const char __pyx_k_u_neig[] = "u_neig";
1743 static const char __pyx_k_volume[] = "volume";
1744 static const char __pyx_k_weight[] = "weight";
1745 static const char __pyx_k_df_dofs[] = "df_dofs";
1746 static const char __pyx_k_eN_left[] = "eN_left";
1747 static const char __pyx_k_gravity[] = "gravity";
1748 static const char __pyx_k_kr_neig[] = "kr_neig";
1749 static const char __pyx_k_nSpace2[] = "nSpace2";
1750 static const char __pyx_k_omega_e[] = "omega_e";
1751 static const char __pyx_k_pcBar_n[] = "pcBar_n";
1752 static const char __pyx_k_q_dmass[] = "q_dmass";
1753 static const char __pyx_k_q_kr_up[] = "q_kr_up";
1754 static const char __pyx_k_thetaSR[] = "thetaSR";
1755 static const char __pyx_k_dmtj_avg[] = "dmtj_avg";
1756 static const char __pyx_k_eN_right[] = "eN_right";
1757 static const char __pyx_k_ebq_vals[] = "ebq_vals";
1758 static const char __pyx_k_integral[] = "integral";
1759 static const char __pyx_k_material[] = "material";
1760 static const char __pyx_k_phi_neig[] = "phi_neig";
1761 static const char __pyx_k_q_grad_u[] = "q_grad_u";
1762 static const char __pyx_k_q_grad_v[] = "q_grad_v";
1763 static const char __pyx_k_q_grad_w[] = "q_grad_w";
1764 static const char __pyx_k_ebN_local[] = "ebN_local";
1765 static const char __pyx_k_pcBar_nM1[] = "pcBar_nM1";
1766 static const char __pyx_k_pcBar_nM2[] = "pcBar_nM2";
1767 static const char __pyx_k_sqrt_sBar[] = "sqrt_sBar";
1768 static const char __pyx_k_transient[] = "transient";
1769 static const char __pyx_k_volFactor[] = "volFactor";
1770 static const char __pyx_k_zVelocity[] = "zVelocity";
1771 static const char __pyx_k_zvelocity[] = "zvelocity";
1772 static const char __pyx_k_DKWr_DpsiC[] = "DKWr_DpsiC";
1773 static const char __pyx_k_ValueError[] = "ValueError";
1774 static const char __pyx_k_matID_neig[] = "matID_neig";
1775 static const char __pyx_k_nAvgWeight[] = "nAvgWeight";
1776 static const char __pyx_k_upwindFlag[] = "upwindFlag";
1777 static const char __pyx_k_DsBar_DpsiC[] = "DsBar_DpsiC";
1778 static const char __pyx_k_DvBar_DpsiC[] = "DvBar_DpsiC";
1779 static const char __pyx_k_ImportError[] = "ImportError";
1780 static const char __pyx_k_eN_neighbor[] = "eN_neighbor";
1781 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1782 static const char __pyx_k_tForReversal[] = "tForReversal";
1783 static const char __pyx_k_DthetaW_DpsiC[] = "DthetaW_DpsiC";
1784 static const char __pyx_k_material_left[] = "material_left";
1785 static const char __pyx_k_weak_residual[] = "weak_residual";
1786 static const char __pyx_k_material_right[] = "material_right";
1787 static const char __pyx_k_ebq_global_vals[] = "ebq_global_vals";
1788 static const char __pyx_k_elementJacobian[] = "elementJacobian";
1789 static const char __pyx_k_elementResidual[] = "elementResidual";
1790 static const char __pyx_k_onePlus_pcBar_n[] = "onePlus_pcBar_n";
1791 static const char __pyx_k_nElements_global[] = "nElements_global";
1792 static const char __pyx_k_nDOF_test_element[] = "nDOF_test_element";
1793 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1794 static const char __pyx_k_material_functions[] = "material_functions";
1795 static const char __pyx_k_nDOF_trial_element[] = "nDOF_trial_element";
1796 static const char __pyx_k_updateMass_weakAvg[] = "updateMass_weakAvg";
1797 static const char __pyx_k_calculateNormalFlux[] = "calculateNormalFlux";
1798 static const char __pyx_k_thisElementIsUpwind[] = "thisElementIsUpwind";
1799 static const char __pyx_k_elementBoundaryTypes[] = "elementBoundaryTypes";
1800 static const char __pyx_k_elementMaterialTypes[] = "elementMaterialTypes";
1801 static const char __pyx_k_elementNeighborsArray[] = "elementNeighborsArray";
1802 static const char __pyx_k_elementBoundariesArray[] = "elementBoundariesArray";
1803 static const char __pyx_k_jacobian_weak_residual[] = "jacobian_weak_residual";
1804 static const char __pyx_k_characteristic_velocity[] = "characteristic_velocity";
1805 static const char __pyx_k_elementBarycentersArray[] = "elementBarycentersArray";
1806 static const char __pyx_k_nElementBoundaries_global[] = "nElementBoundaries_global";
1807 static const char __pyx_k_setElementBoundariesArray[] = "setElementBoundariesArray";
1808 static const char __pyx_k_RE_NCP1_getElementJacobian[] = "RE_NCP1_getElementJacobian";
1809 static const char __pyx_k_RE_NCP1_getElementResidual[] = "RE_NCP1_getElementResidual";
1810 static const char __pyx_k_nElementBoundaries_element[] = "nElementBoundaries_element";
1811 static const char __pyx_k_updateMassJacobian_weakAvg[] = "updateMassJacobian_weakAvg";
1812 static const char __pyx_k_vortexElementVelocityEval3[] = "vortexElementVelocityEval3";
1813 static const char __pyx_k_vortexElementVelocityEval4[] = "vortexElementVelocityEval4";
1814 static const char __pyx_k_helicalElementVelocityEval3[] = "helicalElementVelocityEval3";
1815 static const char __pyx_k_helicalElementVelocityEval4[] = "helicalElementVelocityEval4";
1816 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1817 static const char __pyx_k_characteristic_velocity_dofs[] = "characteristic_velocity_dofs";
1818 static const char __pyx_k_elementBoundaryElementsArray[] = "elementBoundaryElementsArray";
1819 static const char __pyx_k_elementBoundaryMaterialTypes[] = "elementBoundaryMaterialTypes";
1820 static const char __pyx_k_subsurfaceTransportFunctions[] = "subsurfaceTransportFunctions";
1821 static const char __pyx_k_exteriorElementBoundariesArray[] = "exteriorElementBoundariesArray";
1822 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1823 static const char __pyx_k_setExteriorElementBoundaryTypes[] = "setExteriorElementBoundaryTypes";
1824 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1825 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1826 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1827 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie[] = "RE_NCP1_evaluateElementCoefficients_Linear";
1828 static const char __pyx_k_computeSimpleCharacteristicVeloc[] = "computeSimpleCharacteristicVelocityFromElementVelocity";
1829 static const char __pyx_k_evaluateScalarMaterialFunctionOv[] = "evaluateScalarMaterialFunctionOverElements";
1830 static const char __pyx_k_evaluateSparseTensorMaterialFunc[] = "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1831 static const char __pyx_k_evaluateVectorMaterialFunctionOv[] = "evaluateVectorMaterialFunctionOverElements";
1832 static const char __pyx_k_exteriorElementBoundaryMaterialT[] = "exteriorElementBoundaryMaterialTypes";
1833 static const char __pyx_k_nExteriorElementBoundaries_globa[] = "nExteriorElementBoundaries_global";
1834 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1835 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1836 static const char __pyx_k_proteus_subsurfaceTransportFunct[] = "proteus/subsurfaceTransportFunctions.pyx";
1837 static const char __pyx_k_rotatingGaussianElementVelocityE[] = "rotatingGaussianElementVelocityEval3";
1838 static const char __pyx_k_setScalarMaterialFunctionOverEle[] = "setScalarMaterialFunctionOverElements";
1839 static const char __pyx_k_setScalarMaterialFunctionOverGlo[] = "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1840 static const char __pyx_k_setSparseTensorMaterialFunctionO[] = "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1841 static const char __pyx_k_setVectorMaterialFunctionOverEle[] = "setVectorMaterialFunctionOverElements";
1842 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1843 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie_2[] = "RE_NCP1_evaluateElementCoefficients_VGM";
1844 static const char __pyx_k_computeSimpleCharacteristicVeloc_2[] = "computeSimpleCharacteristicVelocityFromVelocityDOFs";
1845 static const char __pyx_k_evaluateScalarMaterialFunctionOv_2[] = "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1846 static const char __pyx_k_evaluateScalarMaterialFunctionOv_3[] = "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1847 static const char __pyx_k_evaluateSparseTensorMaterialFunc_2[] = "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1848 static const char __pyx_k_rotatingGaussianElementVelocityE_2[] = "rotatingGaussianElementVelocityEval4";
1849 static const char __pyx_k_setScalarMaterialFunctionOverEle_2[] = "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1850 static const char __pyx_k_setSparseTensorMaterialFunctionO_2[] = "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1851 static PyObject *__pyx_n_s_DKWr_DpsiC;
1852 static PyObject *__pyx_n_s_DsBar_DpsiC;
1853 static PyObject *__pyx_n_s_DthetaW_DpsiC;
1854 static PyObject *__pyx_n_s_DvBar_DpsiC;
1855 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1856 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1857 static PyObject *__pyx_n_s_I;
1858 static PyObject *__pyx_n_s_ImportError;
1859 static PyObject *__pyx_n_s_J;
1860 static PyObject *__pyx_n_s_KWr;
1861 static PyObject *__pyx_n_s_KWs;
1862 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1863 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie;
1864 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2;
1865 static PyObject *__pyx_n_s_RE_NCP1_getElementJacobian;
1866 static PyObject *__pyx_n_s_RE_NCP1_getElementResidual;
1867 static PyObject *__pyx_n_s_RuntimeError;
1868 static PyObject *__pyx_n_s_ValueError;
1869 static PyObject *__pyx_n_s_a_avg;
1870 static PyObject *__pyx_n_s_a_eN;
1871 static PyObject *__pyx_n_s_a_neig;
1872 static PyObject *__pyx_n_s_a_up;
1873 static PyObject *__pyx_n_s_alpha;
1874 static PyObject *__pyx_n_s_beta;
1875 static PyObject *__pyx_n_s_calculateNormalFlux;
1876 static PyObject *__pyx_n_s_characteristic_velocity;
1877 static PyObject *__pyx_n_s_characteristic_velocity_dofs;
1878 static PyObject *__pyx_n_s_cline_in_traceback;
1879 static PyObject *__pyx_n_s_clock;
1880 static PyObject *__pyx_n_s_colind;
1881 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc;
1882 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc_2;
1883 static PyObject *__pyx_n_s_d;
1884 static PyObject *__pyx_n_s_dS;
1885 static PyObject *__pyx_n_s_dV;
1886 static PyObject *__pyx_n_s_denom;
1887 static PyObject *__pyx_n_s_df;
1888 static PyObject *__pyx_n_s_df_dofs;
1889 static PyObject *__pyx_n_s_dkr_up;
1890 static PyObject *__pyx_n_s_dm;
1891 static PyObject *__pyx_n_s_dmt;
1892 static PyObject *__pyx_n_s_dmtj_avg;
1893 static PyObject *__pyx_n_s_dot;
1894 static PyObject *__pyx_n_s_drhom;
1895 static PyObject *__pyx_n_s_eN;
1896 static PyObject *__pyx_n_s_eN_left;
1897 static PyObject *__pyx_n_s_eN_neighbor;
1898 static PyObject *__pyx_n_s_eN_right;
1899 static PyObject *__pyx_n_s_ebN;
1900 static PyObject *__pyx_n_s_ebNE;
1901 static PyObject *__pyx_n_s_ebN_local;
1902 static PyObject *__pyx_n_s_ebq_global_vals;
1903 static PyObject *__pyx_n_s_ebq_vals;
1904 static PyObject *__pyx_n_s_elementBarycentersArray;
1905 static PyObject *__pyx_n_s_elementBoundariesArray;
1906 static PyObject *__pyx_n_s_elementBoundaryElementsArray;
1907 static PyObject *__pyx_n_s_elementBoundaryMaterialTypes;
1908 static PyObject *__pyx_n_s_elementBoundaryTypes;
1909 static PyObject *__pyx_n_s_elementJacobian;
1910 static PyObject *__pyx_n_s_elementMaterialTypes;
1911 static PyObject *__pyx_n_s_elementNeighborsArray;
1912 static PyObject *__pyx_n_s_elementResidual;
1913 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv;
1914 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_2;
1915 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_3;
1916 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc;
1917 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc_2;
1918 static PyObject *__pyx_n_s_evaluateVectorMaterialFunctionOv;
1919 static PyObject *__pyx_n_s_exteriorElementBoundariesArray;
1920 static PyObject *__pyx_n_s_exteriorElementBoundaryMaterialT;
1921 static PyObject *__pyx_n_s_f_up;
1922 static PyObject *__pyx_n_s_flat;
1923 static PyObject *__pyx_n_s_flux;
1924 static PyObject *__pyx_n_s_gravity;
1925 static PyObject *__pyx_n_s_helicalElementVelocityEval3;
1926 static PyObject *__pyx_n_s_helicalElementVelocityEval4;
1927 static PyObject *__pyx_n_s_i;
1928 static PyObject *__pyx_n_s_ii;
1929 static PyObject *__pyx_n_s_import;
1930 static PyObject *__pyx_n_s_integral;
1931 static PyObject *__pyx_n_s_j;
1932 static PyObject *__pyx_n_s_jacobian_weak_residual;
1933 static PyObject *__pyx_n_s_k;
1934 static PyObject *__pyx_n_s_kb;
1935 static PyObject *__pyx_n_s_kr_eN;
1936 static PyObject *__pyx_n_s_kr_neig;
1937 static PyObject *__pyx_n_s_l2g;
1938 static PyObject *__pyx_n_s_m;
1939 static PyObject *__pyx_n_s_main;
1940 static PyObject *__pyx_n_s_matID;
1941 static PyObject *__pyx_n_s_matID_neig;
1942 static PyObject *__pyx_n_s_material;
1943 static PyObject *__pyx_n_s_material_functions;
1944 static PyObject *__pyx_n_s_material_left;
1945 static PyObject *__pyx_n_s_material_right;
1946 static PyObject *__pyx_n_s_mt;
1947 static PyObject *__pyx_n_s_mt_avg;
1948 static PyObject *__pyx_n_s_n;
1949 static PyObject *__pyx_n_s_nAvgWeight;
1950 static PyObject *__pyx_n_s_nDOF_test_element;
1951 static PyObject *__pyx_n_s_nDOF_trial_element;
1952 static PyObject *__pyx_n_s_nElementBoundaries_element;
1953 static PyObject *__pyx_n_s_nElementBoundaries_global;
1954 static PyObject *__pyx_n_s_nElements_global;
1955 static PyObject *__pyx_n_s_nExteriorElementBoundaries_globa;
1956 static PyObject *__pyx_n_s_nSpace;
1957 static PyObject *__pyx_n_s_nSpace2;
1958 static PyObject *__pyx_n_s_nd;
1959 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
1960 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
1961 static PyObject *__pyx_n_s_nnz;
1962 static PyObject *__pyx_n_s_numer;
1963 static PyObject *__pyx_n_s_numpy;
1964 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1965 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1966 static PyObject *__pyx_n_s_omega_e;
1967 static PyObject *__pyx_n_s_one8;
1968 static PyObject *__pyx_n_s_onePlus_pcBar_n;
1969 static PyObject *__pyx_n_s_pcBar;
1970 static PyObject *__pyx_n_s_pcBar_n;
1971 static PyObject *__pyx_n_s_pcBar_nM1;
1972 static PyObject *__pyx_n_s_pcBar_nM2;
1973 static PyObject *__pyx_n_s_phi_eN;
1974 static PyObject *__pyx_n_s_phi_neig;
1975 static PyObject *__pyx_n_s_pi;
1976 static PyObject *__pyx_n_s_picard;
1977 static PyObject *__pyx_kp_s_proteus_subsurfaceTransportFunct;
1978 static PyObject *__pyx_n_s_psiC;
1979 static PyObject *__pyx_n_s_q;
1980 static PyObject *__pyx_n_s_q_alin;
1981 static PyObject *__pyx_n_s_q_detJ;
1982 static PyObject *__pyx_n_s_q_dkr;
1983 static PyObject *__pyx_n_s_q_dm;
1984 static PyObject *__pyx_n_s_q_dmass;
1985 static PyObject *__pyx_n_s_q_dmt;
1986 static PyObject *__pyx_n_s_q_flin;
1987 static PyObject *__pyx_n_s_q_grad_u;
1988 static PyObject *__pyx_n_s_q_grad_v;
1989 static PyObject *__pyx_n_s_q_grad_w;
1990 static PyObject *__pyx_n_s_q_kr;
1991 static PyObject *__pyx_n_s_q_kr_up;
1992 static PyObject *__pyx_n_s_q_m;
1993 static PyObject *__pyx_n_s_q_mass;
1994 static PyObject *__pyx_n_s_q_mt;
1995 static PyObject *__pyx_n_s_q_r;
1996 static PyObject *__pyx_n_s_q_u;
1997 static PyObject *__pyx_n_s_q_vals;
1998 static PyObject *__pyx_n_s_q_x;
1999 static PyObject *__pyx_n_s_range;
2000 static PyObject *__pyx_n_s_rho;
2001 static PyObject *__pyx_n_s_rho2;
2002 static PyObject *__pyx_n_s_rhom;
2003 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE;
2004 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE_2;
2005 static PyObject *__pyx_n_s_rowptr;
2006 static PyObject *__pyx_n_s_sBar;
2007 static PyObject *__pyx_n_s_setElementBoundariesArray;
2008 static PyObject *__pyx_n_s_setExteriorElementBoundaryTypes;
2009 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle;
2010 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle_2;
2011 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverGlo;
2012 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO;
2013 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO_2;
2014 static PyObject *__pyx_n_s_setVectorMaterialFunctionOverEle;
2015 static PyObject *__pyx_n_s_shape;
2016 static PyObject *__pyx_n_s_sqrt_sBar;
2017 static PyObject *__pyx_n_s_subsurfaceTransportFunctions;
2018 static PyObject *__pyx_n_s_sum;
2019 static PyObject *__pyx_n_s_t;
2020 static PyObject *__pyx_n_s_tForReversal;
2021 static PyObject *__pyx_n_s_test;
2022 static PyObject *__pyx_n_s_thetaR;
2023 static PyObject *__pyx_n_s_thetaS;
2024 static PyObject *__pyx_n_s_thetaSR;
2025 static PyObject *__pyx_n_s_thetaW;
2026 static PyObject *__pyx_n_s_thisElementIsUpwind;
2027 static PyObject *__pyx_n_s_transient;
2028 static PyObject *__pyx_n_s_u_dof;
2029 static PyObject *__pyx_n_s_u_eN;
2030 static PyObject *__pyx_n_s_u_j;
2031 static PyObject *__pyx_n_s_u_l2g;
2032 static PyObject *__pyx_n_s_u_neig;
2033 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
2034 static PyObject *__pyx_n_s_updateMassJacobian_weakAvg;
2035 static PyObject *__pyx_n_s_updateMass_weakAvg;
2036 static PyObject *__pyx_n_s_upwindFlag;
2037 static PyObject *__pyx_n_s_v;
2038 static PyObject *__pyx_n_s_vBar;
2039 static PyObject *__pyx_n_s_vBar2;
2040 static PyObject *__pyx_n_s_vol;
2041 static PyObject *__pyx_n_s_volFactor;
2042 static PyObject *__pyx_n_s_vol_e;
2043 static PyObject *__pyx_n_s_volume;
2044 static PyObject *__pyx_n_s_vortexElementVelocityEval3;
2045 static PyObject *__pyx_n_s_vortexElementVelocityEval4;
2046 static PyObject *__pyx_n_s_w;
2047 static PyObject *__pyx_n_s_weak_residual;
2048 static PyObject *__pyx_n_s_weight;
2049 static PyObject *__pyx_n_s_x;
2050 static PyObject *__pyx_n_s_xc;
2051 static PyObject *__pyx_n_s_yc;
2052 static PyObject *__pyx_n_s_zVelocity;
2053 static PyObject *__pyx_n_s_zeros;
2054 static PyObject *__pyx_n_s_zvelocity;
2055 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes); /* proto */
2056 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes); /* proto */
2057 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2058 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2059 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2060 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2061 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2062 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2063 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2064 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2065 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2066 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2067 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2068 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2069 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin); /* proto */
2070 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up); /* proto */
2071 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual); /* proto */
2072 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian); /* proto */
2073 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual); /* proto */
2074 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual); /* proto */
2075 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux); /* proto */
2076 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
2077 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
2078 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
2079 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
2080 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2081 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2082 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2083 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2084 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2085 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
2086 static PyObject *__pyx_float_0_0;
2087 static PyObject *__pyx_float_0_5;
2088 static PyObject *__pyx_float_2_0;
2089 static PyObject *__pyx_float_1_0eneg_20;
2090 static PyObject *__pyx_slice_;
2091 static PyObject *__pyx_slice__2;
2092 static PyObject *__pyx_slice__3;
2093 static PyObject *__pyx_slice__4;
2094 static PyObject *__pyx_slice__5;
2095 static PyObject *__pyx_slice__6;
2096 static PyObject *__pyx_slice__7;
2097 static PyObject *__pyx_slice__8;
2098 static PyObject *__pyx_tuple__9;
2099 static PyObject *__pyx_tuple__10;
2100 static PyObject *__pyx_tuple__11;
2101 static PyObject *__pyx_tuple__12;
2102 static PyObject *__pyx_tuple__13;
2103 static PyObject *__pyx_tuple__14;
2104 static PyObject *__pyx_tuple__15;
2105 static PyObject *__pyx_tuple__16;
2106 static PyObject *__pyx_tuple__17;
2107 static PyObject *__pyx_tuple__18;
2108 static PyObject *__pyx_tuple__20;
2109 static PyObject *__pyx_tuple__22;
2110 static PyObject *__pyx_tuple__24;
2111 static PyObject *__pyx_tuple__26;
2112 static PyObject *__pyx_tuple__28;
2113 static PyObject *__pyx_tuple__30;
2114 static PyObject *__pyx_tuple__32;
2115 static PyObject *__pyx_tuple__34;
2116 static PyObject *__pyx_tuple__36;
2117 static PyObject *__pyx_tuple__38;
2118 static PyObject *__pyx_tuple__40;
2119 static PyObject *__pyx_tuple__42;
2120 static PyObject *__pyx_tuple__44;
2121 static PyObject *__pyx_tuple__46;
2122 static PyObject *__pyx_tuple__48;
2123 static PyObject *__pyx_tuple__50;
2124 static PyObject *__pyx_tuple__52;
2125 static PyObject *__pyx_tuple__54;
2126 static PyObject *__pyx_tuple__56;
2127 static PyObject *__pyx_tuple__58;
2128 static PyObject *__pyx_tuple__60;
2129 static PyObject *__pyx_tuple__62;
2130 static PyObject *__pyx_tuple__64;
2131 static PyObject *__pyx_tuple__66;
2132 static PyObject *__pyx_tuple__68;
2133 static PyObject *__pyx_tuple__70;
2134 static PyObject *__pyx_tuple__72;
2135 static PyObject *__pyx_tuple__74;
2136 static PyObject *__pyx_codeobj__19;
2137 static PyObject *__pyx_codeobj__21;
2138 static PyObject *__pyx_codeobj__23;
2139 static PyObject *__pyx_codeobj__25;
2140 static PyObject *__pyx_codeobj__27;
2141 static PyObject *__pyx_codeobj__29;
2142 static PyObject *__pyx_codeobj__31;
2143 static PyObject *__pyx_codeobj__33;
2144 static PyObject *__pyx_codeobj__35;
2145 static PyObject *__pyx_codeobj__37;
2146 static PyObject *__pyx_codeobj__39;
2147 static PyObject *__pyx_codeobj__41;
2148 static PyObject *__pyx_codeobj__43;
2149 static PyObject *__pyx_codeobj__45;
2150 static PyObject *__pyx_codeobj__47;
2151 static PyObject *__pyx_codeobj__49;
2152 static PyObject *__pyx_codeobj__51;
2153 static PyObject *__pyx_codeobj__53;
2154 static PyObject *__pyx_codeobj__55;
2155 static PyObject *__pyx_codeobj__57;
2156 static PyObject *__pyx_codeobj__59;
2157 static PyObject *__pyx_codeobj__61;
2158 static PyObject *__pyx_codeobj__63;
2159 static PyObject *__pyx_codeobj__65;
2160 static PyObject *__pyx_codeobj__67;
2161 static PyObject *__pyx_codeobj__69;
2162 static PyObject *__pyx_codeobj__71;
2163 static PyObject *__pyx_codeobj__73;
2164 static PyObject *__pyx_codeobj__75;
2165 /* Late includes */
2166 
2167 /* "subsurfaceTransportFunctions.pyx":11
2168  * double sin(double x)
2169  * double M_PI
2170  * cdef inline double double_max(double a, double b): return a if a >= b else b # <<<<<<<<<<<<<<
2171  * cdef inline double double_min(double a, double b): return a if a <= b else b
2172  *
2173  */
2174 
2175 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_max(double __pyx_v_a, double __pyx_v_b) {
2176  double __pyx_r;
2177  __Pyx_RefNannyDeclarations
2178  double __pyx_t_1;
2179  __Pyx_RefNannySetupContext("double_max", 0);
2180  if (((__pyx_v_a >= __pyx_v_b) != 0)) {
2181  __pyx_t_1 = __pyx_v_a;
2182  } else {
2183  __pyx_t_1 = __pyx_v_b;
2184  }
2185  __pyx_r = __pyx_t_1;
2186  goto __pyx_L0;
2187 
2188  /* function exit code */
2189  __pyx_L0:;
2190  __Pyx_RefNannyFinishContext();
2191  return __pyx_r;
2192 }
2193 
2194 /* "subsurfaceTransportFunctions.pyx":12
2195  * double M_PI
2196  * cdef inline double double_max(double a, double b): return a if a >= b else b
2197  * cdef inline double double_min(double a, double b): return a if a <= b else b # <<<<<<<<<<<<<<
2198  *
2199  * ctypedef numpy.double_t DTYPE_t
2200  */
2201 
2202 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_min(double __pyx_v_a, double __pyx_v_b) {
2203  double __pyx_r;
2204  __Pyx_RefNannyDeclarations
2205  double __pyx_t_1;
2206  __Pyx_RefNannySetupContext("double_min", 0);
2207  if (((__pyx_v_a <= __pyx_v_b) != 0)) {
2208  __pyx_t_1 = __pyx_v_a;
2209  } else {
2210  __pyx_t_1 = __pyx_v_b;
2211  }
2212  __pyx_r = __pyx_t_1;
2213  goto __pyx_L0;
2214 
2215  /* function exit code */
2216  __pyx_L0:;
2217  __Pyx_RefNannyFinishContext();
2218  return __pyx_r;
2219 }
2220 
2221 /* "subsurfaceTransportFunctions.pyx":18
2222  * ctypedef int ITYPE_t
2223  *
2224  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2225  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2226  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2227  */
2228 
2229 /* Python wrapper */
2230 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2231 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes = {"setExteriorElementBoundaryTypes", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, METH_VARARGS|METH_KEYWORDS, 0};
2232 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2233  int __pyx_v_nExteriorElementBoundaries_global;
2234  PyArrayObject *__pyx_v_exteriorElementBoundariesArray = 0;
2235  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2236  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2237  PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes = 0;
2238  PyObject *__pyx_r = 0;
2239  __Pyx_RefNannyDeclarations
2240  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes (wrapper)", 0);
2241  {
2242  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nExteriorElementBoundaries_globa,&__pyx_n_s_exteriorElementBoundariesArray,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_exteriorElementBoundaryMaterialT,0};
2243  PyObject* values[5] = {0,0,0,0,0};
2244  if (unlikely(__pyx_kwds)) {
2245  Py_ssize_t kw_args;
2246  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2247  switch (pos_args) {
2248  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2249  CYTHON_FALLTHROUGH;
2250  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2251  CYTHON_FALLTHROUGH;
2252  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2253  CYTHON_FALLTHROUGH;
2254  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2255  CYTHON_FALLTHROUGH;
2256  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2257  CYTHON_FALLTHROUGH;
2258  case 0: break;
2259  default: goto __pyx_L5_argtuple_error;
2260  }
2261  kw_args = PyDict_Size(__pyx_kwds);
2262  switch (pos_args) {
2263  case 0:
2264  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nExteriorElementBoundaries_globa)) != 0)) kw_args--;
2265  else goto __pyx_L5_argtuple_error;
2266  CYTHON_FALLTHROUGH;
2267  case 1:
2268  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundariesArray)) != 0)) kw_args--;
2269  else {
2270  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 1); __PYX_ERR(0, 18, __pyx_L3_error)
2271  }
2272  CYTHON_FALLTHROUGH;
2273  case 2:
2274  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2275  else {
2276  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 2); __PYX_ERR(0, 18, __pyx_L3_error)
2277  }
2278  CYTHON_FALLTHROUGH;
2279  case 3:
2280  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2281  else {
2282  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 3); __PYX_ERR(0, 18, __pyx_L3_error)
2283  }
2284  CYTHON_FALLTHROUGH;
2285  case 4:
2286  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundaryMaterialT)) != 0)) kw_args--;
2287  else {
2288  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 4); __PYX_ERR(0, 18, __pyx_L3_error)
2289  }
2290  }
2291  if (unlikely(kw_args > 0)) {
2292  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setExteriorElementBoundaryTypes") < 0)) __PYX_ERR(0, 18, __pyx_L3_error)
2293  }
2294  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
2295  goto __pyx_L5_argtuple_error;
2296  } else {
2297  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2298  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2299  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2300  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2301  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2302  }
2303  __pyx_v_nExteriorElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nExteriorElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
2304  __pyx_v_exteriorElementBoundariesArray = ((PyArrayObject *)values[1]);
2305  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[2]);
2306  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[3]);
2307  __pyx_v_exteriorElementBoundaryMaterialTypes = ((PyArrayObject *)values[4]);
2308  }
2309  goto __pyx_L4_argument_unpacking_done;
2310  __pyx_L5_argtuple_error:;
2311  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error)
2312  __pyx_L3_error:;
2313  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2314  __Pyx_RefNannyFinishContext();
2315  return NULL;
2316  __pyx_L4_argument_unpacking_done:;
2317  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundariesArray", 0))) __PYX_ERR(0, 19, __pyx_L1_error)
2318  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 20, __pyx_L1_error)
2319  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 21, __pyx_L1_error)
2320  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 22, __pyx_L1_error)
2321  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(__pyx_self, __pyx_v_nExteriorElementBoundaries_global, __pyx_v_exteriorElementBoundariesArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_exteriorElementBoundaryMaterialTypes);
2322 
2323  /* function exit code */
2324  goto __pyx_L0;
2325  __pyx_L1_error:;
2326  __pyx_r = NULL;
2327  __pyx_L0:;
2328  __Pyx_RefNannyFinishContext();
2329  return __pyx_r;
2330 }
2331 
2332 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes) {
2333  int __pyx_v_ebNE;
2334  int __pyx_v_ebN;
2335  int __pyx_v_eN;
2336  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2337  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2338  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2339  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2340  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundariesArray;
2341  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundariesArray;
2342  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes;
2343  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2344  PyObject *__pyx_r = NULL;
2345  __Pyx_RefNannyDeclarations
2346  int __pyx_t_1;
2347  int __pyx_t_2;
2348  int __pyx_t_3;
2349  Py_ssize_t __pyx_t_4;
2350  int __pyx_t_5;
2351  Py_ssize_t __pyx_t_6;
2352  Py_ssize_t __pyx_t_7;
2353  Py_ssize_t __pyx_t_8;
2354  Py_ssize_t __pyx_t_9;
2355  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes", 0);
2356  __pyx_pybuffer_exteriorElementBoundariesArray.pybuffer.buf = NULL;
2357  __pyx_pybuffer_exteriorElementBoundariesArray.refcount = 0;
2358  __pyx_pybuffernd_exteriorElementBoundariesArray.data = NULL;
2359  __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer = &__pyx_pybuffer_exteriorElementBoundariesArray;
2360  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2361  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2362  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2363  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2364  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2365  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2366  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2367  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2368  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.pybuffer.buf = NULL;
2369  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.refcount = 0;
2370  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.data = NULL;
2371  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2372  {
2373  __Pyx_BufFmt_StackElem __pyx_stack[1];
2374  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2375  }
2376  __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.shape[0];
2377  {
2378  __Pyx_BufFmt_StackElem __pyx_stack[1];
2379  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2380  }
2381  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2382  {
2383  __Pyx_BufFmt_StackElem __pyx_stack[1];
2384  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2385  }
2386  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2387  {
2388  __Pyx_BufFmt_StackElem __pyx_stack[1];
2389  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2390  }
2391  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0];
2392 
2393  /* "subsurfaceTransportFunctions.pyx":24
2394  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundaryMaterialTypes):
2395  * cdef int ebNE,ebN,eN
2396  * for ebNE in range(nExteriorElementBoundaries_global): # <<<<<<<<<<<<<<
2397  * ebN = exteriorElementBoundariesArray[ebNE]
2398  * eN = elementBoundaryElementsArray[ebN,0]
2399  */
2400  __pyx_t_1 = __pyx_v_nExteriorElementBoundaries_global;
2401  __pyx_t_2 = __pyx_t_1;
2402  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2403  __pyx_v_ebNE = __pyx_t_3;
2404 
2405  /* "subsurfaceTransportFunctions.pyx":25
2406  * cdef int ebNE,ebN,eN
2407  * for ebNE in range(nExteriorElementBoundaries_global):
2408  * ebN = exteriorElementBoundariesArray[ebNE] # <<<<<<<<<<<<<<
2409  * eN = elementBoundaryElementsArray[ebN,0]
2410  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2411  */
2412  __pyx_t_4 = __pyx_v_ebNE;
2413  __pyx_t_5 = -1;
2414  if (__pyx_t_4 < 0) {
2415  __pyx_t_4 += __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape;
2416  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2417  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape)) __pyx_t_5 = 0;
2418  if (unlikely(__pyx_t_5 != -1)) {
2419  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2420  __PYX_ERR(0, 25, __pyx_L1_error)
2421  }
2422  __pyx_v_ebN = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides));
2423 
2424  /* "subsurfaceTransportFunctions.pyx":26
2425  * for ebNE in range(nExteriorElementBoundaries_global):
2426  * ebN = exteriorElementBoundariesArray[ebNE]
2427  * eN = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2428  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2429  *
2430  */
2431  __pyx_t_6 = __pyx_v_ebN;
2432  __pyx_t_7 = 0;
2433  __pyx_t_5 = -1;
2434  if (__pyx_t_6 < 0) {
2435  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2436  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
2437  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_5 = 0;
2438  if (__pyx_t_7 < 0) {
2439  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2440  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
2441  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_5 = 1;
2442  if (unlikely(__pyx_t_5 != -1)) {
2443  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2444  __PYX_ERR(0, 26, __pyx_L1_error)
2445  }
2446  __pyx_v_eN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2447 
2448  /* "subsurfaceTransportFunctions.pyx":27
2449  * ebN = exteriorElementBoundariesArray[ebNE]
2450  * eN = elementBoundaryElementsArray[ebN,0]
2451  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
2452  *
2453  * def setElementBoundariesArray(int nElementBoundaries_global,
2454  */
2455  __pyx_t_8 = __pyx_v_eN;
2456  __pyx_t_5 = -1;
2457  if (__pyx_t_8 < 0) {
2458  __pyx_t_8 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2459  if (unlikely(__pyx_t_8 < 0)) __pyx_t_5 = 0;
2460  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2461  if (unlikely(__pyx_t_5 != -1)) {
2462  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2463  __PYX_ERR(0, 27, __pyx_L1_error)
2464  }
2465  __pyx_t_9 = __pyx_v_ebNE;
2466  __pyx_t_5 = -1;
2467  if (__pyx_t_9 < 0) {
2468  __pyx_t_9 += __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape;
2469  if (unlikely(__pyx_t_9 < 0)) __pyx_t_5 = 0;
2470  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2471  if (unlikely(__pyx_t_5 != -1)) {
2472  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2473  __PYX_ERR(0, 27, __pyx_L1_error)
2474  }
2475  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2476  }
2477 
2478  /* "subsurfaceTransportFunctions.pyx":18
2479  * ctypedef int ITYPE_t
2480  *
2481  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2482  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2483  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2484  */
2485 
2486  /* function exit code */
2487  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2488  goto __pyx_L0;
2489  __pyx_L1_error:;
2490  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2491  __Pyx_PyThreadState_declare
2492  __Pyx_PyThreadState_assign
2493  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2494  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2495  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2496  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2497  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2498  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2499  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2500  __pyx_r = NULL;
2501  goto __pyx_L2;
2502  __pyx_L0:;
2503  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2504  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2505  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2506  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2507  __pyx_L2:;
2508  __Pyx_XGIVEREF(__pyx_r);
2509  __Pyx_RefNannyFinishContext();
2510  return __pyx_r;
2511 }
2512 
2513 /* "subsurfaceTransportFunctions.pyx":29
2514  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2515  *
2516  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2517  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2518  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2519  */
2520 
2521 /* Python wrapper */
2522 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2523 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray = {"setElementBoundariesArray", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray, METH_VARARGS|METH_KEYWORDS, 0};
2524 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2525  int __pyx_v_nElementBoundaries_global;
2526  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2527  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2528  PyArrayObject *__pyx_v_elementBoundaryMaterialTypes = 0;
2529  PyObject *__pyx_r = 0;
2530  __Pyx_RefNannyDeclarations
2531  __Pyx_RefNannySetupContext("setElementBoundariesArray (wrapper)", 0);
2532  {
2533  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nElementBoundaries_global,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_elementBoundaryMaterialTypes,0};
2534  PyObject* values[4] = {0,0,0,0};
2535  if (unlikely(__pyx_kwds)) {
2536  Py_ssize_t kw_args;
2537  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2538  switch (pos_args) {
2539  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2540  CYTHON_FALLTHROUGH;
2541  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2542  CYTHON_FALLTHROUGH;
2543  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2544  CYTHON_FALLTHROUGH;
2545  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2546  CYTHON_FALLTHROUGH;
2547  case 0: break;
2548  default: goto __pyx_L5_argtuple_error;
2549  }
2550  kw_args = PyDict_Size(__pyx_kwds);
2551  switch (pos_args) {
2552  case 0:
2553  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_global)) != 0)) kw_args--;
2554  else goto __pyx_L5_argtuple_error;
2555  CYTHON_FALLTHROUGH;
2556  case 1:
2557  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2558  else {
2559  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 1); __PYX_ERR(0, 29, __pyx_L3_error)
2560  }
2561  CYTHON_FALLTHROUGH;
2562  case 2:
2563  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2564  else {
2565  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 2); __PYX_ERR(0, 29, __pyx_L3_error)
2566  }
2567  CYTHON_FALLTHROUGH;
2568  case 3:
2569  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryMaterialTypes)) != 0)) kw_args--;
2570  else {
2571  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 3); __PYX_ERR(0, 29, __pyx_L3_error)
2572  }
2573  }
2574  if (unlikely(kw_args > 0)) {
2575  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setElementBoundariesArray") < 0)) __PYX_ERR(0, 29, __pyx_L3_error)
2576  }
2577  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2578  goto __pyx_L5_argtuple_error;
2579  } else {
2580  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2581  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2582  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2583  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2584  }
2585  __pyx_v_nElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error)
2586  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[1]);
2587  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[2]);
2588  __pyx_v_elementBoundaryMaterialTypes = ((PyArrayObject *)values[3]);
2589  }
2590  goto __pyx_L4_argument_unpacking_done;
2591  __pyx_L5_argtuple_error:;
2592  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 29, __pyx_L3_error)
2593  __pyx_L3_error:;
2594  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2595  __Pyx_RefNannyFinishContext();
2596  return NULL;
2597  __pyx_L4_argument_unpacking_done:;
2598  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 30, __pyx_L1_error)
2599  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 31, __pyx_L1_error)
2600  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 32, __pyx_L1_error)
2601  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(__pyx_self, __pyx_v_nElementBoundaries_global, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_elementBoundaryMaterialTypes);
2602 
2603  /* function exit code */
2604  goto __pyx_L0;
2605  __pyx_L1_error:;
2606  __pyx_r = NULL;
2607  __pyx_L0:;
2608  __Pyx_RefNannyFinishContext();
2609  return __pyx_r;
2610 }
2611 
2612 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes) {
2613  int __pyx_v_ebN;
2614  int __pyx_v_eN_left;
2615  int __pyx_v_eN_right;
2616  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2617  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2618  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryMaterialTypes;
2619  __Pyx_Buffer __pyx_pybuffer_elementBoundaryMaterialTypes;
2620  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2621  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2622  PyObject *__pyx_r = NULL;
2623  __Pyx_RefNannyDeclarations
2624  int __pyx_t_1;
2625  int __pyx_t_2;
2626  int __pyx_t_3;
2627  Py_ssize_t __pyx_t_4;
2628  Py_ssize_t __pyx_t_5;
2629  int __pyx_t_6;
2630  Py_ssize_t __pyx_t_7;
2631  Py_ssize_t __pyx_t_8;
2632  Py_ssize_t __pyx_t_9;
2633  Py_ssize_t __pyx_t_10;
2634  Py_ssize_t __pyx_t_11;
2635  Py_ssize_t __pyx_t_12;
2636  Py_ssize_t __pyx_t_13;
2637  Py_ssize_t __pyx_t_14;
2638  int __pyx_t_15;
2639  Py_ssize_t __pyx_t_16;
2640  Py_ssize_t __pyx_t_17;
2641  Py_ssize_t __pyx_t_18;
2642  __Pyx_RefNannySetupContext("setElementBoundariesArray", 0);
2643  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2644  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2645  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2646  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2647  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2648  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2649  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2650  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2651  __pyx_pybuffer_elementBoundaryMaterialTypes.pybuffer.buf = NULL;
2652  __pyx_pybuffer_elementBoundaryMaterialTypes.refcount = 0;
2653  __pyx_pybuffernd_elementBoundaryMaterialTypes.data = NULL;
2654  __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryMaterialTypes;
2655  {
2656  __Pyx_BufFmt_StackElem __pyx_stack[1];
2657  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2658  }
2659  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2660  {
2661  __Pyx_BufFmt_StackElem __pyx_stack[1];
2662  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2663  }
2664  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2665  {
2666  __Pyx_BufFmt_StackElem __pyx_stack[1];
2667  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2668  }
2669  __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[1];
2670 
2671  /* "subsurfaceTransportFunctions.pyx":34
2672  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryMaterialTypes):
2673  * cdef int ebN,eN_left,eN_right
2674  * for ebN in range(nElementBoundaries_global): # <<<<<<<<<<<<<<
2675  * eN_left = elementBoundaryElementsArray[ebN,0]
2676  * eN_right= elementBoundaryElementsArray[ebN,1]
2677  */
2678  __pyx_t_1 = __pyx_v_nElementBoundaries_global;
2679  __pyx_t_2 = __pyx_t_1;
2680  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2681  __pyx_v_ebN = __pyx_t_3;
2682 
2683  /* "subsurfaceTransportFunctions.pyx":35
2684  * cdef int ebN,eN_left,eN_right
2685  * for ebN in range(nElementBoundaries_global):
2686  * eN_left = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2687  * eN_right= elementBoundaryElementsArray[ebN,1]
2688  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2689  */
2690  __pyx_t_4 = __pyx_v_ebN;
2691  __pyx_t_5 = 0;
2692  __pyx_t_6 = -1;
2693  if (__pyx_t_4 < 0) {
2694  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2695  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2696  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_6 = 0;
2697  if (__pyx_t_5 < 0) {
2698  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2699  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
2700  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_6 = 1;
2701  if (unlikely(__pyx_t_6 != -1)) {
2702  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2703  __PYX_ERR(0, 35, __pyx_L1_error)
2704  }
2705  __pyx_v_eN_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2706 
2707  /* "subsurfaceTransportFunctions.pyx":36
2708  * for ebN in range(nElementBoundaries_global):
2709  * eN_left = elementBoundaryElementsArray[ebN,0]
2710  * eN_right= elementBoundaryElementsArray[ebN,1] # <<<<<<<<<<<<<<
2711  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2712  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2713  */
2714  __pyx_t_7 = __pyx_v_ebN;
2715  __pyx_t_8 = 1;
2716  __pyx_t_6 = -1;
2717  if (__pyx_t_7 < 0) {
2718  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2719  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
2720  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_6 = 0;
2721  if (__pyx_t_8 < 0) {
2722  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2723  if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 1;
2724  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_6 = 1;
2725  if (unlikely(__pyx_t_6 != -1)) {
2726  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2727  __PYX_ERR(0, 36, __pyx_L1_error)
2728  }
2729  __pyx_v_eN_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2730 
2731  /* "subsurfaceTransportFunctions.pyx":37
2732  * eN_left = elementBoundaryElementsArray[ebN,0]
2733  * eN_right= elementBoundaryElementsArray[ebN,1]
2734  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2735  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2736  * if eN_right >= 0:
2737  */
2738  __pyx_t_9 = __pyx_v_eN_left;
2739  __pyx_t_6 = -1;
2740  if (__pyx_t_9 < 0) {
2741  __pyx_t_9 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2742  if (unlikely(__pyx_t_9 < 0)) __pyx_t_6 = 0;
2743  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2744  if (unlikely(__pyx_t_6 != -1)) {
2745  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2746  __PYX_ERR(0, 37, __pyx_L1_error)
2747  }
2748  __pyx_t_10 = __pyx_v_ebN;
2749  __pyx_t_11 = 0;
2750  __pyx_t_6 = -1;
2751  if (__pyx_t_10 < 0) {
2752  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2753  if (unlikely(__pyx_t_10 < 0)) __pyx_t_6 = 0;
2754  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2755  if (__pyx_t_11 < 0) {
2756  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2757  if (unlikely(__pyx_t_11 < 0)) __pyx_t_6 = 1;
2758  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2759  if (unlikely(__pyx_t_6 != -1)) {
2760  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2761  __PYX_ERR(0, 37, __pyx_L1_error)
2762  }
2763  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2764 
2765  /* "subsurfaceTransportFunctions.pyx":38
2766  * eN_right= elementBoundaryElementsArray[ebN,1]
2767  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2768  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2769  * if eN_right >= 0:
2770  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2771  */
2772  __pyx_t_12 = __pyx_v_eN_left;
2773  __pyx_t_6 = -1;
2774  if (__pyx_t_12 < 0) {
2775  __pyx_t_12 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2776  if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0;
2777  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2778  if (unlikely(__pyx_t_6 != -1)) {
2779  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2780  __PYX_ERR(0, 38, __pyx_L1_error)
2781  }
2782  __pyx_t_13 = __pyx_v_ebN;
2783  __pyx_t_14 = 1;
2784  __pyx_t_6 = -1;
2785  if (__pyx_t_13 < 0) {
2786  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2787  if (unlikely(__pyx_t_13 < 0)) __pyx_t_6 = 0;
2788  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2789  if (__pyx_t_14 < 0) {
2790  __pyx_t_14 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2791  if (unlikely(__pyx_t_14 < 0)) __pyx_t_6 = 1;
2792  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2793  if (unlikely(__pyx_t_6 != -1)) {
2794  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2795  __PYX_ERR(0, 38, __pyx_L1_error)
2796  }
2797  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2798 
2799  /* "subsurfaceTransportFunctions.pyx":39
2800  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2801  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2802  * if eN_right >= 0: # <<<<<<<<<<<<<<
2803  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2804  *
2805  */
2806  __pyx_t_15 = ((__pyx_v_eN_right >= 0) != 0);
2807  if (__pyx_t_15) {
2808 
2809  /* "subsurfaceTransportFunctions.pyx":40
2810  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2811  * if eN_right >= 0:
2812  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right] # <<<<<<<<<<<<<<
2813  *
2814  * ###
2815  */
2816  __pyx_t_16 = __pyx_v_eN_right;
2817  __pyx_t_6 = -1;
2818  if (__pyx_t_16 < 0) {
2819  __pyx_t_16 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2820  if (unlikely(__pyx_t_16 < 0)) __pyx_t_6 = 0;
2821  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2822  if (unlikely(__pyx_t_6 != -1)) {
2823  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2824  __PYX_ERR(0, 40, __pyx_L1_error)
2825  }
2826  __pyx_t_17 = __pyx_v_ebN;
2827  __pyx_t_18 = 1;
2828  __pyx_t_6 = -1;
2829  if (__pyx_t_17 < 0) {
2830  __pyx_t_17 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2831  if (unlikely(__pyx_t_17 < 0)) __pyx_t_6 = 0;
2832  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2833  if (__pyx_t_18 < 0) {
2834  __pyx_t_18 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2835  if (unlikely(__pyx_t_18 < 0)) __pyx_t_6 = 1;
2836  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2837  if (unlikely(__pyx_t_6 != -1)) {
2838  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2839  __PYX_ERR(0, 40, __pyx_L1_error)
2840  }
2841  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2842 
2843  /* "subsurfaceTransportFunctions.pyx":39
2844  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2845  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2846  * if eN_right >= 0: # <<<<<<<<<<<<<<
2847  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2848  *
2849  */
2850  }
2851  }
2852 
2853  /* "subsurfaceTransportFunctions.pyx":29
2854  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2855  *
2856  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2857  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2858  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2859  */
2860 
2861  /* function exit code */
2862  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2863  goto __pyx_L0;
2864  __pyx_L1_error:;
2865  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2866  __Pyx_PyThreadState_declare
2867  __Pyx_PyThreadState_assign
2868  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2869  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2870  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2871  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2872  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2873  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2874  __pyx_r = NULL;
2875  goto __pyx_L2;
2876  __pyx_L0:;
2877  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2878  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2879  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2880  __pyx_L2:;
2881  __Pyx_XGIVEREF(__pyx_r);
2882  __Pyx_RefNannyFinishContext();
2883  return __pyx_r;
2884 }
2885 
2886 /* "subsurfaceTransportFunctions.pyx":43
2887  *
2888  * ###
2889  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
2890  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
2891  * dict material_functions):
2892  */
2893 
2894 /* Python wrapper */
2895 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2896 static char __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and set is material j\n likely little improvement right now without correct typing of material_functions\n ";
2897 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements = {"setScalarMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements};
2898 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2899  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2900  PyArrayObject *__pyx_v_q_vals = 0;
2901  PyObject *__pyx_v_material_functions = 0;
2902  PyObject *__pyx_r = 0;
2903  __Pyx_RefNannyDeclarations
2904  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements (wrapper)", 0);
2905  {
2906  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
2907  PyObject* values[3] = {0,0,0};
2908  if (unlikely(__pyx_kwds)) {
2909  Py_ssize_t kw_args;
2910  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2911  switch (pos_args) {
2912  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2913  CYTHON_FALLTHROUGH;
2914  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2915  CYTHON_FALLTHROUGH;
2916  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2917  CYTHON_FALLTHROUGH;
2918  case 0: break;
2919  default: goto __pyx_L5_argtuple_error;
2920  }
2921  kw_args = PyDict_Size(__pyx_kwds);
2922  switch (pos_args) {
2923  case 0:
2924  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2925  else goto __pyx_L5_argtuple_error;
2926  CYTHON_FALLTHROUGH;
2927  case 1:
2928  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
2929  else {
2930  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 43, __pyx_L3_error)
2931  }
2932  CYTHON_FALLTHROUGH;
2933  case 2:
2934  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
2935  else {
2936  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 43, __pyx_L3_error)
2937  }
2938  }
2939  if (unlikely(kw_args > 0)) {
2940  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 43, __pyx_L3_error)
2941  }
2942  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2943  goto __pyx_L5_argtuple_error;
2944  } else {
2945  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2946  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2947  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2948  }
2949  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
2950  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
2951  __pyx_v_material_functions = ((PyObject*)values[2]);
2952  }
2953  goto __pyx_L4_argument_unpacking_done;
2954  __pyx_L5_argtuple_error:;
2955  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 43, __pyx_L3_error)
2956  __pyx_L3_error:;
2957  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
2958  __Pyx_RefNannyFinishContext();
2959  return NULL;
2960  __pyx_L4_argument_unpacking_done:;
2961  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 43, __pyx_L1_error)
2962  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 44, __pyx_L1_error)
2963  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 45, __pyx_L1_error)
2964  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
2965 
2966  /* function exit code */
2967  goto __pyx_L0;
2968  __pyx_L1_error:;
2969  __pyx_r = NULL;
2970  __pyx_L0:;
2971  __Pyx_RefNannyFinishContext();
2972  return __pyx_r;
2973 }
2974 
2975 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
2976  int __pyx_v_eN;
2977  int __pyx_v_k;
2978  int __pyx_v_material;
2979  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2980  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2981  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
2982  __Pyx_Buffer __pyx_pybuffer_q_vals;
2983  PyObject *__pyx_r = NULL;
2984  __Pyx_RefNannyDeclarations
2985  npy_intp __pyx_t_1;
2986  npy_intp __pyx_t_2;
2987  int __pyx_t_3;
2988  Py_ssize_t __pyx_t_4;
2989  int __pyx_t_5;
2990  npy_intp __pyx_t_6;
2991  npy_intp __pyx_t_7;
2992  PyObject *__pyx_t_8 = NULL;
2993  PyObject *__pyx_t_9 = NULL;
2994  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_10;
2995  Py_ssize_t __pyx_t_11;
2996  Py_ssize_t __pyx_t_12;
2997  int __pyx_t_13;
2998  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements", 0);
2999  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
3000  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
3001  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
3002  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
3003  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
3004  __pyx_pybuffer_q_vals.refcount = 0;
3005  __pyx_pybuffernd_q_vals.data = NULL;
3006  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
3007  {
3008  __Pyx_BufFmt_StackElem __pyx_stack[1];
3009  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
3010  }
3011  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
3012  {
3013  __Pyx_BufFmt_StackElem __pyx_stack[1];
3014  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
3015  }
3016  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
3017 
3018  /* "subsurfaceTransportFunctions.pyx":51
3019  * """
3020  * cdef int eN,k,material
3021  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
3022  * material = elementMaterialTypes[eN]
3023  * for k in range(q_vals.shape[1]):
3024  */
3025  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
3026  __pyx_t_2 = __pyx_t_1;
3027  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3028  __pyx_v_eN = __pyx_t_3;
3029 
3030  /* "subsurfaceTransportFunctions.pyx":52
3031  * cdef int eN,k,material
3032  * for eN in range(q_vals.shape[0]):
3033  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
3034  * for k in range(q_vals.shape[1]):
3035  * q_vals[eN,k] = material_functions[material]
3036  */
3037  __pyx_t_4 = __pyx_v_eN;
3038  __pyx_t_5 = -1;
3039  if (__pyx_t_4 < 0) {
3040  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3041  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
3042  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
3043  if (unlikely(__pyx_t_5 != -1)) {
3044  __Pyx_RaiseBufferIndexError(__pyx_t_5);
3045  __PYX_ERR(0, 52, __pyx_L1_error)
3046  }
3047  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3048 
3049  /* "subsurfaceTransportFunctions.pyx":53
3050  * for eN in range(q_vals.shape[0]):
3051  * material = elementMaterialTypes[eN]
3052  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
3053  * q_vals[eN,k] = material_functions[material]
3054  *
3055  */
3056  __pyx_t_6 = (__pyx_v_q_vals->dimensions[1]);
3057  __pyx_t_7 = __pyx_t_6;
3058  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
3059  __pyx_v_k = __pyx_t_5;
3060 
3061  /* "subsurfaceTransportFunctions.pyx":54
3062  * material = elementMaterialTypes[eN]
3063  * for k in range(q_vals.shape[1]):
3064  * q_vals[eN,k] = material_functions[material] # <<<<<<<<<<<<<<
3065  *
3066  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
3067  */
3068  if (unlikely(__pyx_v_material_functions == Py_None)) {
3069  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3070  __PYX_ERR(0, 54, __pyx_L1_error)
3071  }
3072  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 54, __pyx_L1_error)
3073  __Pyx_GOTREF(__pyx_t_8);
3074  __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 54, __pyx_L1_error)
3075  __Pyx_GOTREF(__pyx_t_9);
3076  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3077  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_10 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
3078  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3079  __pyx_t_11 = __pyx_v_eN;
3080  __pyx_t_12 = __pyx_v_k;
3081  __pyx_t_13 = -1;
3082  if (__pyx_t_11 < 0) {
3083  __pyx_t_11 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
3084  if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 0;
3085  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_13 = 0;
3086  if (__pyx_t_12 < 0) {
3087  __pyx_t_12 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
3088  if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 1;
3089  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_13 = 1;
3090  if (unlikely(__pyx_t_13 != -1)) {
3091  __Pyx_RaiseBufferIndexError(__pyx_t_13);
3092  __PYX_ERR(0, 54, __pyx_L1_error)
3093  }
3094  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_10;
3095  }
3096  }
3097 
3098  /* "subsurfaceTransportFunctions.pyx":43
3099  *
3100  * ###
3101  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3102  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
3103  * dict material_functions):
3104  */
3105 
3106  /* function exit code */
3107  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3108  goto __pyx_L0;
3109  __pyx_L1_error:;
3110  __Pyx_XDECREF(__pyx_t_8);
3111  __Pyx_XDECREF(__pyx_t_9);
3112  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3113  __Pyx_PyThreadState_declare
3114  __Pyx_PyThreadState_assign
3115  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3116  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3117  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3118  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3119  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3120  __pyx_r = NULL;
3121  goto __pyx_L2;
3122  __pyx_L0:;
3123  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3124  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3125  __pyx_L2:;
3126  __Pyx_XGIVEREF(__pyx_r);
3127  __Pyx_RefNannyFinishContext();
3128  return __pyx_r;
3129 }
3130 
3131 /* "subsurfaceTransportFunctions.pyx":56
3132  * q_vals[eN,k] = material_functions[material]
3133  *
3134  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3135  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
3136  * dict material_functions):
3137  */
3138 
3139 /* Python wrapper */
3140 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3141 static char __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and set \013ec f_j assuming element is material j\n ";
3142 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements = {"setVectorMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements};
3143 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3144  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
3145  PyArrayObject *__pyx_v_q_vals = 0;
3146  PyObject *__pyx_v_material_functions = 0;
3147  PyObject *__pyx_r = 0;
3148  __Pyx_RefNannyDeclarations
3149  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements (wrapper)", 0);
3150  {
3151  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
3152  PyObject* values[3] = {0,0,0};
3153  if (unlikely(__pyx_kwds)) {
3154  Py_ssize_t kw_args;
3155  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3156  switch (pos_args) {
3157  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3158  CYTHON_FALLTHROUGH;
3159  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3160  CYTHON_FALLTHROUGH;
3161  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3162  CYTHON_FALLTHROUGH;
3163  case 0: break;
3164  default: goto __pyx_L5_argtuple_error;
3165  }
3166  kw_args = PyDict_Size(__pyx_kwds);
3167  switch (pos_args) {
3168  case 0:
3169  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
3170  else goto __pyx_L5_argtuple_error;
3171  CYTHON_FALLTHROUGH;
3172  case 1:
3173  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
3174  else {
3175  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 56, __pyx_L3_error)
3176  }
3177  CYTHON_FALLTHROUGH;
3178  case 2:
3179  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3180  else {
3181  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 56, __pyx_L3_error)
3182  }
3183  }
3184  if (unlikely(kw_args > 0)) {
3185  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 56, __pyx_L3_error)
3186  }
3187  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3188  goto __pyx_L5_argtuple_error;
3189  } else {
3190  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3191  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3192  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3193  }
3194  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
3195  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
3196  __pyx_v_material_functions = ((PyObject*)values[2]);
3197  }
3198  goto __pyx_L4_argument_unpacking_done;
3199  __pyx_L5_argtuple_error:;
3200  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error)
3201  __pyx_L3_error:;
3202  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3203  __Pyx_RefNannyFinishContext();
3204  return NULL;
3205  __pyx_L4_argument_unpacking_done:;
3206  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 56, __pyx_L1_error)
3207  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 57, __pyx_L1_error)
3208  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 58, __pyx_L1_error)
3209  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
3210 
3211  /* function exit code */
3212  goto __pyx_L0;
3213  __pyx_L1_error:;
3214  __pyx_r = NULL;
3215  __pyx_L0:;
3216  __Pyx_RefNannyFinishContext();
3217  return __pyx_r;
3218 }
3219 
3220 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
3221  int __pyx_v_eN;
3222  int __pyx_v_k;
3223  int __pyx_v_material;
3224  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
3225  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
3226  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
3227  __Pyx_Buffer __pyx_pybuffer_q_vals;
3228  PyObject *__pyx_r = NULL;
3229  __Pyx_RefNannyDeclarations
3230  npy_intp __pyx_t_1;
3231  npy_intp __pyx_t_2;
3232  int __pyx_t_3;
3233  Py_ssize_t __pyx_t_4;
3234  int __pyx_t_5;
3235  npy_intp __pyx_t_6;
3236  npy_intp __pyx_t_7;
3237  PyObject *__pyx_t_8 = NULL;
3238  PyObject *__pyx_t_9 = NULL;
3239  PyObject *__pyx_t_10 = NULL;
3240  PyObject *__pyx_t_11 = NULL;
3241  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements", 0);
3242  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
3243  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
3244  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
3245  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
3246  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
3247  __pyx_pybuffer_q_vals.refcount = 0;
3248  __pyx_pybuffernd_q_vals.data = NULL;
3249  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
3250  {
3251  __Pyx_BufFmt_StackElem __pyx_stack[1];
3252  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3253  }
3254  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
3255  {
3256  __Pyx_BufFmt_StackElem __pyx_stack[1];
3257  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3258  }
3259  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
3260 
3261  /* "subsurfaceTransportFunctions.pyx":63
3262  * """
3263  * cdef int eN,k,material
3264  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
3265  * material = elementMaterialTypes[eN]
3266  * for k in range(q_vals.shape[1]):
3267  */
3268  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
3269  __pyx_t_2 = __pyx_t_1;
3270  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3271  __pyx_v_eN = __pyx_t_3;
3272 
3273  /* "subsurfaceTransportFunctions.pyx":64
3274  * cdef int eN,k,material
3275  * for eN in range(q_vals.shape[0]):
3276  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
3277  * for k in range(q_vals.shape[1]):
3278  * q_vals[eN,k,:] = material_functions[material].flat
3279  */
3280  __pyx_t_4 = __pyx_v_eN;
3281  __pyx_t_5 = -1;
3282  if (__pyx_t_4 < 0) {
3283  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3284  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
3285  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
3286  if (unlikely(__pyx_t_5 != -1)) {
3287  __Pyx_RaiseBufferIndexError(__pyx_t_5);
3288  __PYX_ERR(0, 64, __pyx_L1_error)
3289  }
3290  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3291 
3292  /* "subsurfaceTransportFunctions.pyx":65
3293  * for eN in range(q_vals.shape[0]):
3294  * material = elementMaterialTypes[eN]
3295  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
3296  * q_vals[eN,k,:] = material_functions[material].flat
3297  *
3298  */
3299  __pyx_t_6 = (__pyx_v_q_vals->dimensions[1]);
3300  __pyx_t_7 = __pyx_t_6;
3301  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
3302  __pyx_v_k = __pyx_t_5;
3303 
3304  /* "subsurfaceTransportFunctions.pyx":66
3305  * material = elementMaterialTypes[eN]
3306  * for k in range(q_vals.shape[1]):
3307  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
3308  *
3309  *
3310  */
3311  if (unlikely(__pyx_v_material_functions == Py_None)) {
3312  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3313  __PYX_ERR(0, 66, __pyx_L1_error)
3314  }
3315  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L1_error)
3316  __Pyx_GOTREF(__pyx_t_8);
3317  __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error)
3318  __Pyx_GOTREF(__pyx_t_9);
3319  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3320  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_flat); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L1_error)
3321  __Pyx_GOTREF(__pyx_t_8);
3322  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3323  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error)
3324  __Pyx_GOTREF(__pyx_t_9);
3325  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 66, __pyx_L1_error)
3326  __Pyx_GOTREF(__pyx_t_10);
3327  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 66, __pyx_L1_error)
3328  __Pyx_GOTREF(__pyx_t_11);
3329  __Pyx_GIVEREF(__pyx_t_9);
3330  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
3331  __Pyx_GIVEREF(__pyx_t_10);
3332  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
3333  __Pyx_INCREF(__pyx_slice_);
3334  __Pyx_GIVEREF(__pyx_slice_);
3335  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_slice_);
3336  __pyx_t_9 = 0;
3337  __pyx_t_10 = 0;
3338  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_11, __pyx_t_8) < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
3339  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3340  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3341  }
3342  }
3343 
3344  /* "subsurfaceTransportFunctions.pyx":56
3345  * q_vals[eN,k] = material_functions[material]
3346  *
3347  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3348  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
3349  * dict material_functions):
3350  */
3351 
3352  /* function exit code */
3353  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3354  goto __pyx_L0;
3355  __pyx_L1_error:;
3356  __Pyx_XDECREF(__pyx_t_8);
3357  __Pyx_XDECREF(__pyx_t_9);
3358  __Pyx_XDECREF(__pyx_t_10);
3359  __Pyx_XDECREF(__pyx_t_11);
3360  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3361  __Pyx_PyThreadState_declare
3362  __Pyx_PyThreadState_assign
3363  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3364  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3365  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3366  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3367  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3368  __pyx_r = NULL;
3369  goto __pyx_L2;
3370  __pyx_L0:;
3371  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3372  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3373  __pyx_L2:;
3374  __Pyx_XGIVEREF(__pyx_r);
3375  __Pyx_RefNannyFinishContext();
3376  return __pyx_r;
3377 }
3378 
3379 /* "subsurfaceTransportFunctions.pyx":69
3380  *
3381  *
3382  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3383  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3384  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3385  */
3386 
3387 /* Python wrapper */
3388 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3389 static char __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and set f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3390 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
3391 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3392  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3393  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3394  PyArrayObject *__pyx_v_ebq_vals = 0;
3395  PyObject *__pyx_v_material_functions = 0;
3396  PyObject *__pyx_r = 0;
3397  __Pyx_RefNannyDeclarations
3398  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
3399  {
3400  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3401  PyObject* values[4] = {0,0,0,0};
3402  if (unlikely(__pyx_kwds)) {
3403  Py_ssize_t kw_args;
3404  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3405  switch (pos_args) {
3406  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3407  CYTHON_FALLTHROUGH;
3408  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3409  CYTHON_FALLTHROUGH;
3410  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3411  CYTHON_FALLTHROUGH;
3412  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3413  CYTHON_FALLTHROUGH;
3414  case 0: break;
3415  default: goto __pyx_L5_argtuple_error;
3416  }
3417  kw_args = PyDict_Size(__pyx_kwds);
3418  switch (pos_args) {
3419  case 0:
3420  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3421  else goto __pyx_L5_argtuple_error;
3422  CYTHON_FALLTHROUGH;
3423  case 1:
3424  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3425  else {
3426  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 69, __pyx_L3_error)
3427  }
3428  CYTHON_FALLTHROUGH;
3429  case 2:
3430  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3431  else {
3432  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 69, __pyx_L3_error)
3433  }
3434  CYTHON_FALLTHROUGH;
3435  case 3:
3436  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3437  else {
3438  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 69, __pyx_L3_error)
3439  }
3440  }
3441  if (unlikely(kw_args > 0)) {
3442  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 69, __pyx_L3_error)
3443  }
3444  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3445  goto __pyx_L5_argtuple_error;
3446  } else {
3447  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3448  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3449  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3450  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3451  }
3452  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
3453  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
3454  __pyx_v_ebq_vals = ((PyArrayObject *)values[2]);
3455  __pyx_v_material_functions = ((PyObject*)values[3]);
3456  }
3457  goto __pyx_L4_argument_unpacking_done;
3458  __pyx_L5_argtuple_error:;
3459  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error)
3460  __pyx_L3_error:;
3461  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3462  __Pyx_RefNannyFinishContext();
3463  return NULL;
3464  __pyx_L4_argument_unpacking_done:;
3465  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 69, __pyx_L1_error)
3466  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 70, __pyx_L1_error)
3467  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 71, __pyx_L1_error)
3468  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 72, __pyx_L1_error)
3469  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3470 
3471  /* function exit code */
3472  goto __pyx_L0;
3473  __pyx_L1_error:;
3474  __pyx_r = NULL;
3475  __pyx_L0:;
3476  __Pyx_RefNannyFinishContext();
3477  return __pyx_r;
3478 }
3479 
3480 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3481  int __pyx_v_eN;
3482  int __pyx_v_ebN;
3483  int __pyx_v_ebN_local;
3484  int __pyx_v_k;
3485  int __pyx_v_material_left;
3486  int __pyx_v_material_right;
3487  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3488  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
3489  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3490  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
3491  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3492  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3493  PyObject *__pyx_r = NULL;
3494  __Pyx_RefNannyDeclarations
3495  npy_intp __pyx_t_1;
3496  npy_intp __pyx_t_2;
3497  int __pyx_t_3;
3498  npy_intp __pyx_t_4;
3499  npy_intp __pyx_t_5;
3500  int __pyx_t_6;
3501  Py_ssize_t __pyx_t_7;
3502  Py_ssize_t __pyx_t_8;
3503  int __pyx_t_9;
3504  Py_ssize_t __pyx_t_10;
3505  Py_ssize_t __pyx_t_11;
3506  Py_ssize_t __pyx_t_12;
3507  Py_ssize_t __pyx_t_13;
3508  npy_intp __pyx_t_14;
3509  npy_intp __pyx_t_15;
3510  PyObject *__pyx_t_16 = NULL;
3511  PyObject *__pyx_t_17 = NULL;
3512  PyObject *__pyx_t_18 = NULL;
3513  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_19;
3514  Py_ssize_t __pyx_t_20;
3515  Py_ssize_t __pyx_t_21;
3516  Py_ssize_t __pyx_t_22;
3517  int __pyx_t_23;
3518  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
3519  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
3520  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
3521  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
3522  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
3523  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
3524  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
3525  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
3526  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
3527  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
3528  __pyx_pybuffer_ebq_vals.refcount = 0;
3529  __pyx_pybuffernd_ebq_vals.data = NULL;
3530  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
3531  {
3532  __Pyx_BufFmt_StackElem __pyx_stack[1];
3533  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3534  }
3535  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
3536  {
3537  __Pyx_BufFmt_StackElem __pyx_stack[1];
3538  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3539  }
3540  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
3541  {
3542  __Pyx_BufFmt_StackElem __pyx_stack[1];
3543  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3544  }
3545  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
3546 
3547  /* "subsurfaceTransportFunctions.pyx":82
3548  * cdef int eN,ebN,ebN_local,k,material_left,material_right
3549  *
3550  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
3551  * for ebN_local in range(ebq_vals.shape[1]):
3552  * ebN = elementBoundariesArray[eN,ebN_local]
3553  */
3554  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
3555  __pyx_t_2 = __pyx_t_1;
3556  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3557  __pyx_v_eN = __pyx_t_3;
3558 
3559  /* "subsurfaceTransportFunctions.pyx":83
3560  *
3561  * for eN in range(ebq_vals.shape[0]):
3562  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
3563  * ebN = elementBoundariesArray[eN,ebN_local]
3564  * material_left = elementBoundaryTypes[ebN,0]
3565  */
3566  __pyx_t_4 = (__pyx_v_ebq_vals->dimensions[1]);
3567  __pyx_t_5 = __pyx_t_4;
3568  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
3569  __pyx_v_ebN_local = __pyx_t_6;
3570 
3571  /* "subsurfaceTransportFunctions.pyx":84
3572  * for eN in range(ebq_vals.shape[0]):
3573  * for ebN_local in range(ebq_vals.shape[1]):
3574  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
3575  * material_left = elementBoundaryTypes[ebN,0]
3576  * material_right= elementBoundaryTypes[ebN,1]
3577  */
3578  __pyx_t_7 = __pyx_v_eN;
3579  __pyx_t_8 = __pyx_v_ebN_local;
3580  __pyx_t_9 = -1;
3581  if (__pyx_t_7 < 0) {
3582  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
3583  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
3584  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
3585  if (__pyx_t_8 < 0) {
3586  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
3587  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
3588  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
3589  if (unlikely(__pyx_t_9 != -1)) {
3590  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3591  __PYX_ERR(0, 84, __pyx_L1_error)
3592  }
3593  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
3594 
3595  /* "subsurfaceTransportFunctions.pyx":85
3596  * for ebN_local in range(ebq_vals.shape[1]):
3597  * ebN = elementBoundariesArray[eN,ebN_local]
3598  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
3599  * material_right= elementBoundaryTypes[ebN,1]
3600  * for k in range(ebq_vals.shape[2]):
3601  */
3602  __pyx_t_10 = __pyx_v_ebN;
3603  __pyx_t_11 = 0;
3604  __pyx_t_9 = -1;
3605  if (__pyx_t_10 < 0) {
3606  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3607  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
3608  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
3609  if (__pyx_t_11 < 0) {
3610  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3611  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
3612  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
3613  if (unlikely(__pyx_t_9 != -1)) {
3614  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3615  __PYX_ERR(0, 85, __pyx_L1_error)
3616  }
3617  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3618 
3619  /* "subsurfaceTransportFunctions.pyx":86
3620  * ebN = elementBoundariesArray[eN,ebN_local]
3621  * material_left = elementBoundaryTypes[ebN,0]
3622  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
3623  * for k in range(ebq_vals.shape[2]):
3624  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3625  */
3626  __pyx_t_12 = __pyx_v_ebN;
3627  __pyx_t_13 = 1;
3628  __pyx_t_9 = -1;
3629  if (__pyx_t_12 < 0) {
3630  __pyx_t_12 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3631  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
3632  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
3633  if (__pyx_t_13 < 0) {
3634  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3635  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
3636  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
3637  if (unlikely(__pyx_t_9 != -1)) {
3638  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3639  __PYX_ERR(0, 86, __pyx_L1_error)
3640  }
3641  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3642 
3643  /* "subsurfaceTransportFunctions.pyx":87
3644  * material_left = elementBoundaryTypes[ebN,0]
3645  * material_right= elementBoundaryTypes[ebN,1]
3646  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
3647  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3648  * material_functions[material_right])
3649  */
3650  __pyx_t_14 = (__pyx_v_ebq_vals->dimensions[2]);
3651  __pyx_t_15 = __pyx_t_14;
3652  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_15; __pyx_t_9+=1) {
3653  __pyx_v_k = __pyx_t_9;
3654 
3655  /* "subsurfaceTransportFunctions.pyx":88
3656  * material_right= elementBoundaryTypes[ebN,1]
3657  * for k in range(ebq_vals.shape[2]):
3658  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3659  * material_functions[material_right])
3660  *
3661  */
3662  if (unlikely(__pyx_v_material_functions == Py_None)) {
3663  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3664  __PYX_ERR(0, 88, __pyx_L1_error)
3665  }
3666  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 88, __pyx_L1_error)
3667  __Pyx_GOTREF(__pyx_t_16);
3668  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 88, __pyx_L1_error)
3669  __Pyx_GOTREF(__pyx_t_17);
3670  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
3671 
3672  /* "subsurfaceTransportFunctions.pyx":89
3673  * for k in range(ebq_vals.shape[2]):
3674  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3675  * material_functions[material_right]) # <<<<<<<<<<<<<<
3676  *
3677  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
3678  */
3679  if (unlikely(__pyx_v_material_functions == Py_None)) {
3680  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3681  __PYX_ERR(0, 89, __pyx_L1_error)
3682  }
3683  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 89, __pyx_L1_error)
3684  __Pyx_GOTREF(__pyx_t_16);
3685  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 89, __pyx_L1_error)
3686  __Pyx_GOTREF(__pyx_t_18);
3687  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
3688 
3689  /* "subsurfaceTransportFunctions.pyx":88
3690  * material_right= elementBoundaryTypes[ebN,1]
3691  * for k in range(ebq_vals.shape[2]):
3692  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3693  * material_functions[material_right])
3694  *
3695  */
3696  __pyx_t_16 = PyNumber_Add(__pyx_t_17, __pyx_t_18); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 88, __pyx_L1_error)
3697  __Pyx_GOTREF(__pyx_t_16);
3698  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3699  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3700  __pyx_t_18 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 88, __pyx_L1_error)
3701  __Pyx_GOTREF(__pyx_t_18);
3702  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
3703  __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_t_18); if (unlikely((__pyx_t_19 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error)
3704  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3705  __pyx_t_20 = __pyx_v_eN;
3706  __pyx_t_21 = __pyx_v_ebN_local;
3707  __pyx_t_22 = __pyx_v_k;
3708  __pyx_t_23 = -1;
3709  if (__pyx_t_20 < 0) {
3710  __pyx_t_20 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
3711  if (unlikely(__pyx_t_20 < 0)) __pyx_t_23 = 0;
3712  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_23 = 0;
3713  if (__pyx_t_21 < 0) {
3714  __pyx_t_21 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
3715  if (unlikely(__pyx_t_21 < 0)) __pyx_t_23 = 1;
3716  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_23 = 1;
3717  if (__pyx_t_22 < 0) {
3718  __pyx_t_22 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
3719  if (unlikely(__pyx_t_22 < 0)) __pyx_t_23 = 2;
3720  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_23 = 2;
3721  if (unlikely(__pyx_t_23 != -1)) {
3722  __Pyx_RaiseBufferIndexError(__pyx_t_23);
3723  __PYX_ERR(0, 88, __pyx_L1_error)
3724  }
3725  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_19;
3726  }
3727  }
3728  }
3729 
3730  /* "subsurfaceTransportFunctions.pyx":69
3731  *
3732  *
3733  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3734  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3735  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3736  */
3737 
3738  /* function exit code */
3739  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3740  goto __pyx_L0;
3741  __pyx_L1_error:;
3742  __Pyx_XDECREF(__pyx_t_16);
3743  __Pyx_XDECREF(__pyx_t_17);
3744  __Pyx_XDECREF(__pyx_t_18);
3745  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3746  __Pyx_PyThreadState_declare
3747  __Pyx_PyThreadState_assign
3748  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3749  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3750  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3751  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3752  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3753  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3754  __pyx_r = NULL;
3755  goto __pyx_L2;
3756  __pyx_L0:;
3757  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3758  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3759  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3760  __pyx_L2:;
3761  __Pyx_XGIVEREF(__pyx_r);
3762  __Pyx_RefNannyFinishContext();
3763  return __pyx_r;
3764 }
3765 
3766 /* "subsurfaceTransportFunctions.pyx":91
3767  * material_functions[material_right])
3768  *
3769  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
3770  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
3771  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3772  */
3773 
3774 /* Python wrapper */
3775 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3776 static char __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn} f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3777 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
3778 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3779  int __pyx_v_nd;
3780  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3781  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3782  PyArrayObject *__pyx_v_ebq_vals = 0;
3783  PyObject *__pyx_v_material_functions = 0;
3784  PyObject *__pyx_r = 0;
3785  __Pyx_RefNannyDeclarations
3786  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
3787  {
3788  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3789  PyObject* values[5] = {0,0,0,0,0};
3790  if (unlikely(__pyx_kwds)) {
3791  Py_ssize_t kw_args;
3792  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3793  switch (pos_args) {
3794  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3795  CYTHON_FALLTHROUGH;
3796  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3797  CYTHON_FALLTHROUGH;
3798  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3799  CYTHON_FALLTHROUGH;
3800  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3801  CYTHON_FALLTHROUGH;
3802  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3803  CYTHON_FALLTHROUGH;
3804  case 0: break;
3805  default: goto __pyx_L5_argtuple_error;
3806  }
3807  kw_args = PyDict_Size(__pyx_kwds);
3808  switch (pos_args) {
3809  case 0:
3810  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
3811  else goto __pyx_L5_argtuple_error;
3812  CYTHON_FALLTHROUGH;
3813  case 1:
3814  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3815  else {
3816  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 91, __pyx_L3_error)
3817  }
3818  CYTHON_FALLTHROUGH;
3819  case 2:
3820  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3821  else {
3822  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 91, __pyx_L3_error)
3823  }
3824  CYTHON_FALLTHROUGH;
3825  case 3:
3826  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3827  else {
3828  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 91, __pyx_L3_error)
3829  }
3830  CYTHON_FALLTHROUGH;
3831  case 4:
3832  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3833  else {
3834  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 91, __pyx_L3_error)
3835  }
3836  }
3837  if (unlikely(kw_args > 0)) {
3838  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 91, __pyx_L3_error)
3839  }
3840  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
3841  goto __pyx_L5_argtuple_error;
3842  } else {
3843  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3844  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3845  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3846  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3847  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3848  }
3849  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
3850  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
3851  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
3852  __pyx_v_ebq_vals = ((PyArrayObject *)values[3]);
3853  __pyx_v_material_functions = ((PyObject*)values[4]);
3854  }
3855  goto __pyx_L4_argument_unpacking_done;
3856  __pyx_L5_argtuple_error:;
3857  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error)
3858  __pyx_L3_error:;
3859  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3860  __Pyx_RefNannyFinishContext();
3861  return NULL;
3862  __pyx_L4_argument_unpacking_done:;
3863  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 92, __pyx_L1_error)
3864  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 93, __pyx_L1_error)
3865  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 94, __pyx_L1_error)
3866  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 95, __pyx_L1_error)
3867  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3868 
3869  /* function exit code */
3870  goto __pyx_L0;
3871  __pyx_L1_error:;
3872  __pyx_r = NULL;
3873  __pyx_L0:;
3874  __Pyx_RefNannyFinishContext();
3875  return __pyx_r;
3876 }
3877 
3878 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3879  int __pyx_v_eN;
3880  int __pyx_v_ebN;
3881  int __pyx_v_ebN_local;
3882  int __pyx_v_k;
3883  int __pyx_v_material_left;
3884  int __pyx_v_material_right;
3885  int __pyx_v_I;
3886  int __pyx_v_J;
3887  double __pyx_v_numer;
3888  double __pyx_v_denom;
3889  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3890  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
3891  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3892  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
3893  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3894  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3895  PyObject *__pyx_r = NULL;
3896  __Pyx_RefNannyDeclarations
3897  npy_intp __pyx_t_1;
3898  npy_intp __pyx_t_2;
3899  int __pyx_t_3;
3900  npy_intp __pyx_t_4;
3901  npy_intp __pyx_t_5;
3902  int __pyx_t_6;
3903  Py_ssize_t __pyx_t_7;
3904  Py_ssize_t __pyx_t_8;
3905  int __pyx_t_9;
3906  Py_ssize_t __pyx_t_10;
3907  Py_ssize_t __pyx_t_11;
3908  Py_ssize_t __pyx_t_12;
3909  Py_ssize_t __pyx_t_13;
3910  npy_intp __pyx_t_14;
3911  npy_intp __pyx_t_15;
3912  int __pyx_t_16;
3913  int __pyx_t_17;
3914  int __pyx_t_18;
3915  int __pyx_t_19;
3916  int __pyx_t_20;
3917  int __pyx_t_21;
3918  PyObject *__pyx_t_22 = NULL;
3919  PyObject *__pyx_t_23 = NULL;
3920  PyObject *__pyx_t_24 = NULL;
3921  PyObject *__pyx_t_25 = NULL;
3922  PyObject *__pyx_t_26 = NULL;
3923  double __pyx_t_27;
3924  Py_ssize_t __pyx_t_28;
3925  Py_ssize_t __pyx_t_29;
3926  Py_ssize_t __pyx_t_30;
3927  Py_ssize_t __pyx_t_31;
3928  int __pyx_t_32;
3929  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
3930  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
3931  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
3932  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
3933  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
3934  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
3935  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
3936  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
3937  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
3938  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
3939  __pyx_pybuffer_ebq_vals.refcount = 0;
3940  __pyx_pybuffernd_ebq_vals.data = NULL;
3941  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
3942  {
3943  __Pyx_BufFmt_StackElem __pyx_stack[1];
3944  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
3945  }
3946  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
3947  {
3948  __Pyx_BufFmt_StackElem __pyx_stack[1];
3949  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
3950  }
3951  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
3952  {
3953  __Pyx_BufFmt_StackElem __pyx_stack[1];
3954  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
3955  }
3956  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
3957 
3958  /* "subsurfaceTransportFunctions.pyx":106
3959  * cdef double numer,denom
3960  *
3961  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
3962  * for ebN_local in range(ebq_vals.shape[1]):
3963  * ebN = elementBoundariesArray[eN,ebN_local]
3964  */
3965  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
3966  __pyx_t_2 = __pyx_t_1;
3967  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3968  __pyx_v_eN = __pyx_t_3;
3969 
3970  /* "subsurfaceTransportFunctions.pyx":107
3971  *
3972  * for eN in range(ebq_vals.shape[0]):
3973  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
3974  * ebN = elementBoundariesArray[eN,ebN_local]
3975  * material_left = elementBoundaryTypes[ebN,0]
3976  */
3977  __pyx_t_4 = (__pyx_v_ebq_vals->dimensions[1]);
3978  __pyx_t_5 = __pyx_t_4;
3979  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
3980  __pyx_v_ebN_local = __pyx_t_6;
3981 
3982  /* "subsurfaceTransportFunctions.pyx":108
3983  * for eN in range(ebq_vals.shape[0]):
3984  * for ebN_local in range(ebq_vals.shape[1]):
3985  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
3986  * material_left = elementBoundaryTypes[ebN,0]
3987  * material_right= elementBoundaryTypes[ebN,1]
3988  */
3989  __pyx_t_7 = __pyx_v_eN;
3990  __pyx_t_8 = __pyx_v_ebN_local;
3991  __pyx_t_9 = -1;
3992  if (__pyx_t_7 < 0) {
3993  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
3994  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
3995  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
3996  if (__pyx_t_8 < 0) {
3997  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
3998  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
3999  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
4000  if (unlikely(__pyx_t_9 != -1)) {
4001  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4002  __PYX_ERR(0, 108, __pyx_L1_error)
4003  }
4004  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
4005 
4006  /* "subsurfaceTransportFunctions.pyx":109
4007  * for ebN_local in range(ebq_vals.shape[1]):
4008  * ebN = elementBoundariesArray[eN,ebN_local]
4009  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4010  * material_right= elementBoundaryTypes[ebN,1]
4011  * for k in range(ebq_vals.shape[2]):
4012  */
4013  __pyx_t_10 = __pyx_v_ebN;
4014  __pyx_t_11 = 0;
4015  __pyx_t_9 = -1;
4016  if (__pyx_t_10 < 0) {
4017  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4018  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
4019  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
4020  if (__pyx_t_11 < 0) {
4021  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4022  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
4023  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
4024  if (unlikely(__pyx_t_9 != -1)) {
4025  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4026  __PYX_ERR(0, 109, __pyx_L1_error)
4027  }
4028  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4029 
4030  /* "subsurfaceTransportFunctions.pyx":110
4031  * ebN = elementBoundariesArray[eN,ebN_local]
4032  * material_left = elementBoundaryTypes[ebN,0]
4033  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4034  * for k in range(ebq_vals.shape[2]):
4035  * for I in range(nd):
4036  */
4037  __pyx_t_12 = __pyx_v_ebN;
4038  __pyx_t_13 = 1;
4039  __pyx_t_9 = -1;
4040  if (__pyx_t_12 < 0) {
4041  __pyx_t_12 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4042  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
4043  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
4044  if (__pyx_t_13 < 0) {
4045  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4046  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
4047  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
4048  if (unlikely(__pyx_t_9 != -1)) {
4049  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4050  __PYX_ERR(0, 110, __pyx_L1_error)
4051  }
4052  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4053 
4054  /* "subsurfaceTransportFunctions.pyx":111
4055  * material_left = elementBoundaryTypes[ebN,0]
4056  * material_right= elementBoundaryTypes[ebN,1]
4057  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
4058  * for I in range(nd):
4059  * for J in range(nd):
4060  */
4061  __pyx_t_14 = (__pyx_v_ebq_vals->dimensions[2]);
4062  __pyx_t_15 = __pyx_t_14;
4063  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_15; __pyx_t_9+=1) {
4064  __pyx_v_k = __pyx_t_9;
4065 
4066  /* "subsurfaceTransportFunctions.pyx":112
4067  * material_right= elementBoundaryTypes[ebN,1]
4068  * for k in range(ebq_vals.shape[2]):
4069  * for I in range(nd): # <<<<<<<<<<<<<<
4070  * for J in range(nd):
4071  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4072  */
4073  __pyx_t_16 = __pyx_v_nd;
4074  __pyx_t_17 = __pyx_t_16;
4075  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
4076  __pyx_v_I = __pyx_t_18;
4077 
4078  /* "subsurfaceTransportFunctions.pyx":113
4079  * for k in range(ebq_vals.shape[2]):
4080  * for I in range(nd):
4081  * for J in range(nd): # <<<<<<<<<<<<<<
4082  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4083  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4084  */
4085  __pyx_t_19 = __pyx_v_nd;
4086  __pyx_t_20 = __pyx_t_19;
4087  for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
4088  __pyx_v_J = __pyx_t_21;
4089 
4090  /* "subsurfaceTransportFunctions.pyx":114
4091  * for I in range(nd):
4092  * for J in range(nd):
4093  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
4094  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4095  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4096  */
4097  if (unlikely(__pyx_v_material_functions == Py_None)) {
4098  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4099  __PYX_ERR(0, 114, __pyx_L1_error)
4100  }
4101  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4102  __Pyx_GOTREF(__pyx_t_22);
4103  __pyx_t_23 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 114, __pyx_L1_error)
4104  __Pyx_GOTREF(__pyx_t_23);
4105  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4106  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4107  __Pyx_GOTREF(__pyx_t_22);
4108  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 114, __pyx_L1_error)
4109  __Pyx_GOTREF(__pyx_t_24);
4110  __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 114, __pyx_L1_error)
4111  __Pyx_GOTREF(__pyx_t_25);
4112  __Pyx_GIVEREF(__pyx_t_22);
4113  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_22);
4114  __Pyx_GIVEREF(__pyx_t_24);
4115  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_24);
4116  __pyx_t_22 = 0;
4117  __pyx_t_24 = 0;
4118  __pyx_t_24 = __Pyx_PyObject_GetItem(__pyx_t_23, __pyx_t_25); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 114, __pyx_L1_error)
4119  __Pyx_GOTREF(__pyx_t_24);
4120  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
4121  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
4122  __pyx_t_25 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 114, __pyx_L1_error)
4123  __Pyx_GOTREF(__pyx_t_25);
4124  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
4125  if (unlikely(__pyx_v_material_functions == Py_None)) {
4126  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4127  __PYX_ERR(0, 114, __pyx_L1_error)
4128  }
4129  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 114, __pyx_L1_error)
4130  __Pyx_GOTREF(__pyx_t_24);
4131  __pyx_t_23 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_24); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 114, __pyx_L1_error)
4132  __Pyx_GOTREF(__pyx_t_23);
4133  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
4134  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 114, __pyx_L1_error)
4135  __Pyx_GOTREF(__pyx_t_24);
4136  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4137  __Pyx_GOTREF(__pyx_t_22);
4138  __pyx_t_26 = PyTuple_New(2); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 114, __pyx_L1_error)
4139  __Pyx_GOTREF(__pyx_t_26);
4140  __Pyx_GIVEREF(__pyx_t_24);
4141  PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_24);
4142  __Pyx_GIVEREF(__pyx_t_22);
4143  PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_22);
4144  __pyx_t_24 = 0;
4145  __pyx_t_22 = 0;
4146  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_23, __pyx_t_26); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4147  __Pyx_GOTREF(__pyx_t_22);
4148  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
4149  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
4150  __pyx_t_26 = PyNumber_Multiply(__pyx_t_25, __pyx_t_22); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 114, __pyx_L1_error)
4151  __Pyx_GOTREF(__pyx_t_26);
4152  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
4153  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4154  __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_t_26); if (unlikely((__pyx_t_27 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error)
4155  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
4156  __pyx_v_numer = __pyx_t_27;
4157 
4158  /* "subsurfaceTransportFunctions.pyx":115
4159  * for J in range(nd):
4160  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4161  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
4162  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4163  *
4164  */
4165  if (unlikely(__pyx_v_material_functions == Py_None)) {
4166  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4167  __PYX_ERR(0, 115, __pyx_L1_error)
4168  }
4169  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 115, __pyx_L1_error)
4170  __Pyx_GOTREF(__pyx_t_26);
4171  __pyx_t_22 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_26); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4172  __Pyx_GOTREF(__pyx_t_22);
4173  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
4174  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 115, __pyx_L1_error)
4175  __Pyx_GOTREF(__pyx_t_26);
4176  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 115, __pyx_L1_error)
4177  __Pyx_GOTREF(__pyx_t_25);
4178  __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 115, __pyx_L1_error)
4179  __Pyx_GOTREF(__pyx_t_23);
4180  __Pyx_GIVEREF(__pyx_t_26);
4181  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_26);
4182  __Pyx_GIVEREF(__pyx_t_25);
4183  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_25);
4184  __pyx_t_26 = 0;
4185  __pyx_t_25 = 0;
4186  __pyx_t_25 = __Pyx_PyObject_GetItem(__pyx_t_22, __pyx_t_23); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 115, __pyx_L1_error)
4187  __Pyx_GOTREF(__pyx_t_25);
4188  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4189  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
4190  if (unlikely(__pyx_v_material_functions == Py_None)) {
4191  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4192  __PYX_ERR(0, 115, __pyx_L1_error)
4193  }
4194  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 115, __pyx_L1_error)
4195  __Pyx_GOTREF(__pyx_t_23);
4196  __pyx_t_22 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4197  __Pyx_GOTREF(__pyx_t_22);
4198  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
4199  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 115, __pyx_L1_error)
4200  __Pyx_GOTREF(__pyx_t_23);
4201  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 115, __pyx_L1_error)
4202  __Pyx_GOTREF(__pyx_t_26);
4203  __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 115, __pyx_L1_error)
4204  __Pyx_GOTREF(__pyx_t_24);
4205  __Pyx_GIVEREF(__pyx_t_23);
4206  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_23);
4207  __Pyx_GIVEREF(__pyx_t_26);
4208  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_26);
4209  __pyx_t_23 = 0;
4210  __pyx_t_26 = 0;
4211  __pyx_t_26 = __Pyx_PyObject_GetItem(__pyx_t_22, __pyx_t_24); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 115, __pyx_L1_error)
4212  __Pyx_GOTREF(__pyx_t_26);
4213  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4214  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
4215  __pyx_t_24 = PyNumber_Add(__pyx_t_25, __pyx_t_26); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 115, __pyx_L1_error)
4216  __Pyx_GOTREF(__pyx_t_24);
4217  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
4218  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
4219  __pyx_t_26 = __Pyx_PyFloat_AddObjC(__pyx_t_24, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 115, __pyx_L1_error)
4220  __Pyx_GOTREF(__pyx_t_26);
4221  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
4222  __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_t_26); if (unlikely((__pyx_t_27 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
4223  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
4224  __pyx_v_denom = __pyx_t_27;
4225 
4226  /* "subsurfaceTransportFunctions.pyx":116
4227  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4228  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4229  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
4230  *
4231  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4232  */
4233  if (unlikely(__pyx_v_denom == 0)) {
4234  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
4235  __PYX_ERR(0, 116, __pyx_L1_error)
4236  }
4237  __pyx_t_28 = __pyx_v_eN;
4238  __pyx_t_29 = __pyx_v_ebN_local;
4239  __pyx_t_30 = __pyx_v_k;
4240  __pyx_t_31 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
4241  __pyx_t_32 = -1;
4242  if (__pyx_t_28 < 0) {
4243  __pyx_t_28 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
4244  if (unlikely(__pyx_t_28 < 0)) __pyx_t_32 = 0;
4245  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_32 = 0;
4246  if (__pyx_t_29 < 0) {
4247  __pyx_t_29 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
4248  if (unlikely(__pyx_t_29 < 0)) __pyx_t_32 = 1;
4249  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_32 = 1;
4250  if (__pyx_t_30 < 0) {
4251  __pyx_t_30 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
4252  if (unlikely(__pyx_t_30 < 0)) __pyx_t_32 = 2;
4253  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_32 = 2;
4254  if (__pyx_t_31 < 0) {
4255  __pyx_t_31 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
4256  if (unlikely(__pyx_t_31 < 0)) __pyx_t_32 = 3;
4257  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_32 = 3;
4258  if (unlikely(__pyx_t_32 != -1)) {
4259  __Pyx_RaiseBufferIndexError(__pyx_t_32);
4260  __PYX_ERR(0, 116, __pyx_L1_error)
4261  }
4262  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_31, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
4263  }
4264  }
4265  }
4266  }
4267  }
4268 
4269  /* "subsurfaceTransportFunctions.pyx":91
4270  * material_functions[material_right])
4271  *
4272  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4273  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4274  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4275  */
4276 
4277  /* function exit code */
4278  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4279  goto __pyx_L0;
4280  __pyx_L1_error:;
4281  __Pyx_XDECREF(__pyx_t_22);
4282  __Pyx_XDECREF(__pyx_t_23);
4283  __Pyx_XDECREF(__pyx_t_24);
4284  __Pyx_XDECREF(__pyx_t_25);
4285  __Pyx_XDECREF(__pyx_t_26);
4286  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4287  __Pyx_PyThreadState_declare
4288  __Pyx_PyThreadState_assign
4289  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4290  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4291  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4292  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4293  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4294  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4295  __pyx_r = NULL;
4296  goto __pyx_L2;
4297  __pyx_L0:;
4298  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4299  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4300  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4301  __pyx_L2:;
4302  __Pyx_XGIVEREF(__pyx_r);
4303  __Pyx_RefNannyFinishContext();
4304  return __pyx_r;
4305 }
4306 
4307 /* "subsurfaceTransportFunctions.pyx":118
4308  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4309  *
4310  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4311  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4312  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4313  */
4314 
4315 /* Python wrapper */
4316 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4317 static char __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4318 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
4319 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4320  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4321  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4322  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4323  PyObject *__pyx_v_material_functions = 0;
4324  PyObject *__pyx_r = 0;
4325  __Pyx_RefNannyDeclarations
4326  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
4327  {
4328  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4329  PyObject* values[4] = {0,0,0,0};
4330  if (unlikely(__pyx_kwds)) {
4331  Py_ssize_t kw_args;
4332  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4333  switch (pos_args) {
4334  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4335  CYTHON_FALLTHROUGH;
4336  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4337  CYTHON_FALLTHROUGH;
4338  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4339  CYTHON_FALLTHROUGH;
4340  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4341  CYTHON_FALLTHROUGH;
4342  case 0: break;
4343  default: goto __pyx_L5_argtuple_error;
4344  }
4345  kw_args = PyDict_Size(__pyx_kwds);
4346  switch (pos_args) {
4347  case 0:
4348  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4349  else goto __pyx_L5_argtuple_error;
4350  CYTHON_FALLTHROUGH;
4351  case 1:
4352  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4353  else {
4354  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 118, __pyx_L3_error)
4355  }
4356  CYTHON_FALLTHROUGH;
4357  case 2:
4358  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4359  else {
4360  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 118, __pyx_L3_error)
4361  }
4362  CYTHON_FALLTHROUGH;
4363  case 3:
4364  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4365  else {
4366  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 118, __pyx_L3_error)
4367  }
4368  }
4369  if (unlikely(kw_args > 0)) {
4370  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 118, __pyx_L3_error)
4371  }
4372  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
4373  goto __pyx_L5_argtuple_error;
4374  } else {
4375  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4376  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4377  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4378  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4379  }
4380  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
4381  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
4382  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[2]);
4383  __pyx_v_material_functions = ((PyObject*)values[3]);
4384  }
4385  goto __pyx_L4_argument_unpacking_done;
4386  __pyx_L5_argtuple_error:;
4387  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 118, __pyx_L3_error)
4388  __pyx_L3_error:;
4389  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4390  __Pyx_RefNannyFinishContext();
4391  return NULL;
4392  __pyx_L4_argument_unpacking_done:;
4393  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 118, __pyx_L1_error)
4394  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 119, __pyx_L1_error)
4395  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 120, __pyx_L1_error)
4396  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 121, __pyx_L1_error)
4397  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4398 
4399  /* function exit code */
4400  goto __pyx_L0;
4401  __pyx_L1_error:;
4402  __pyx_r = NULL;
4403  __pyx_L0:;
4404  __Pyx_RefNannyFinishContext();
4405  return __pyx_r;
4406 }
4407 
4408 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4409  int __pyx_v_ebN;
4410  int __pyx_v_material_left;
4411  int __pyx_v_material_right;
4412  npy_intp __pyx_v_k;
4413  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4414  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4415  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4416  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4417  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4418  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4419  PyObject *__pyx_r = NULL;
4420  __Pyx_RefNannyDeclarations
4421  npy_intp __pyx_t_1;
4422  npy_intp __pyx_t_2;
4423  int __pyx_t_3;
4424  Py_ssize_t __pyx_t_4;
4425  Py_ssize_t __pyx_t_5;
4426  int __pyx_t_6;
4427  Py_ssize_t __pyx_t_7;
4428  Py_ssize_t __pyx_t_8;
4429  npy_intp __pyx_t_9;
4430  npy_intp __pyx_t_10;
4431  npy_intp __pyx_t_11;
4432  PyObject *__pyx_t_12 = NULL;
4433  PyObject *__pyx_t_13 = NULL;
4434  PyObject *__pyx_t_14 = NULL;
4435  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
4436  Py_ssize_t __pyx_t_16;
4437  Py_ssize_t __pyx_t_17;
4438  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
4439  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4440  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4441  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4442  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4443  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4444  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4445  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4446  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4447  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4448  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4449  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4450  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4451  {
4452  __Pyx_BufFmt_StackElem __pyx_stack[1];
4453  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4454  }
4455  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4456  {
4457  __Pyx_BufFmt_StackElem __pyx_stack[1];
4458  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4459  }
4460  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4461  {
4462  __Pyx_BufFmt_StackElem __pyx_stack[1];
4463  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4464  }
4465  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
4466 
4467  /* "subsurfaceTransportFunctions.pyx":131
4468  * cdef int ebN,material_left,material_right
4469  *
4470  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4471  * material_left = elementBoundaryTypes[ebN,0]
4472  * material_right= elementBoundaryTypes[ebN,1]
4473  */
4474  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4475  __pyx_t_2 = __pyx_t_1;
4476  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4477  __pyx_v_ebN = __pyx_t_3;
4478 
4479  /* "subsurfaceTransportFunctions.pyx":132
4480  *
4481  * for ebN in range(ebq_global_vals.shape[0]):
4482  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4483  * material_right= elementBoundaryTypes[ebN,1]
4484  * for k in range(ebq_global_vals.shape[1]):
4485  */
4486  __pyx_t_4 = __pyx_v_ebN;
4487  __pyx_t_5 = 0;
4488  __pyx_t_6 = -1;
4489  if (__pyx_t_4 < 0) {
4490  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4491  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4492  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4493  if (__pyx_t_5 < 0) {
4494  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4495  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4496  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4497  if (unlikely(__pyx_t_6 != -1)) {
4498  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4499  __PYX_ERR(0, 132, __pyx_L1_error)
4500  }
4501  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4502 
4503  /* "subsurfaceTransportFunctions.pyx":133
4504  * for ebN in range(ebq_global_vals.shape[0]):
4505  * material_left = elementBoundaryTypes[ebN,0]
4506  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4507  * for k in range(ebq_global_vals.shape[1]):
4508  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4509  */
4510  __pyx_t_7 = __pyx_v_ebN;
4511  __pyx_t_8 = 1;
4512  __pyx_t_6 = -1;
4513  if (__pyx_t_7 < 0) {
4514  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4515  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
4516  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4517  if (__pyx_t_8 < 0) {
4518  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4519  if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 1;
4520  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4521  if (unlikely(__pyx_t_6 != -1)) {
4522  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4523  __PYX_ERR(0, 133, __pyx_L1_error)
4524  }
4525  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4526 
4527  /* "subsurfaceTransportFunctions.pyx":134
4528  * material_left = elementBoundaryTypes[ebN,0]
4529  * material_right= elementBoundaryTypes[ebN,1]
4530  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
4531  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4532  * material_functions[material_right])
4533  */
4534  __pyx_t_9 = (__pyx_v_ebq_global_vals->dimensions[1]);
4535  __pyx_t_10 = __pyx_t_9;
4536  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
4537  __pyx_v_k = __pyx_t_11;
4538 
4539  /* "subsurfaceTransportFunctions.pyx":135
4540  * material_right= elementBoundaryTypes[ebN,1]
4541  * for k in range(ebq_global_vals.shape[1]):
4542  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4543  * material_functions[material_right])
4544  *
4545  */
4546  if (unlikely(__pyx_v_material_functions == Py_None)) {
4547  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4548  __PYX_ERR(0, 135, __pyx_L1_error)
4549  }
4550  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 135, __pyx_L1_error)
4551  __Pyx_GOTREF(__pyx_t_12);
4552  __pyx_t_13 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 135, __pyx_L1_error)
4553  __Pyx_GOTREF(__pyx_t_13);
4554  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4555 
4556  /* "subsurfaceTransportFunctions.pyx":136
4557  * for k in range(ebq_global_vals.shape[1]):
4558  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4559  * material_functions[material_right]) # <<<<<<<<<<<<<<
4560  *
4561  *
4562  */
4563  if (unlikely(__pyx_v_material_functions == Py_None)) {
4564  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4565  __PYX_ERR(0, 136, __pyx_L1_error)
4566  }
4567  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 136, __pyx_L1_error)
4568  __Pyx_GOTREF(__pyx_t_12);
4569  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 136, __pyx_L1_error)
4570  __Pyx_GOTREF(__pyx_t_14);
4571  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4572 
4573  /* "subsurfaceTransportFunctions.pyx":135
4574  * material_right= elementBoundaryTypes[ebN,1]
4575  * for k in range(ebq_global_vals.shape[1]):
4576  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4577  * material_functions[material_right])
4578  *
4579  */
4580  __pyx_t_12 = PyNumber_Add(__pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 135, __pyx_L1_error)
4581  __Pyx_GOTREF(__pyx_t_12);
4582  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4583  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4584  __pyx_t_14 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 135, __pyx_L1_error)
4585  __Pyx_GOTREF(__pyx_t_14);
4586  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4587  __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_15 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
4588  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4589  __pyx_t_16 = __pyx_v_ebN;
4590  __pyx_t_17 = __pyx_v_k;
4591  __pyx_t_6 = -1;
4592  if (__pyx_t_16 < 0) {
4593  __pyx_t_16 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
4594  if (unlikely(__pyx_t_16 < 0)) __pyx_t_6 = 0;
4595  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_6 = 0;
4596  if (__pyx_t_17 < 0) {
4597  __pyx_t_17 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
4598  if (unlikely(__pyx_t_17 < 0)) __pyx_t_6 = 1;
4599  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_6 = 1;
4600  if (unlikely(__pyx_t_6 != -1)) {
4601  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4602  __PYX_ERR(0, 135, __pyx_L1_error)
4603  }
4604  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_15;
4605  }
4606  }
4607 
4608  /* "subsurfaceTransportFunctions.pyx":118
4609  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4610  *
4611  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4612  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4613  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4614  */
4615 
4616  /* function exit code */
4617  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4618  goto __pyx_L0;
4619  __pyx_L1_error:;
4620  __Pyx_XDECREF(__pyx_t_12);
4621  __Pyx_XDECREF(__pyx_t_13);
4622  __Pyx_XDECREF(__pyx_t_14);
4623  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4624  __Pyx_PyThreadState_declare
4625  __Pyx_PyThreadState_assign
4626  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4627  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4628  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4629  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4630  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4631  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4632  __pyx_r = NULL;
4633  goto __pyx_L2;
4634  __pyx_L0:;
4635  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4636  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4637  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4638  __pyx_L2:;
4639  __Pyx_XGIVEREF(__pyx_r);
4640  __Pyx_RefNannyFinishContext();
4641  return __pyx_r;
4642 }
4643 
4644 /* "subsurfaceTransportFunctions.pyx":139
4645  *
4646  *
4647  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4648  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4649  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4650  */
4651 
4652 /* Python wrapper */
4653 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4654 static char __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn}f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4655 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
4656 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4657  int __pyx_v_nd;
4658  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4659  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4660  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4661  PyObject *__pyx_v_material_functions = 0;
4662  PyObject *__pyx_r = 0;
4663  __Pyx_RefNannyDeclarations
4664  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
4665  {
4666  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4667  PyObject* values[5] = {0,0,0,0,0};
4668  if (unlikely(__pyx_kwds)) {
4669  Py_ssize_t kw_args;
4670  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4671  switch (pos_args) {
4672  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4673  CYTHON_FALLTHROUGH;
4674  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4675  CYTHON_FALLTHROUGH;
4676  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4677  CYTHON_FALLTHROUGH;
4678  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4679  CYTHON_FALLTHROUGH;
4680  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4681  CYTHON_FALLTHROUGH;
4682  case 0: break;
4683  default: goto __pyx_L5_argtuple_error;
4684  }
4685  kw_args = PyDict_Size(__pyx_kwds);
4686  switch (pos_args) {
4687  case 0:
4688  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4689  else goto __pyx_L5_argtuple_error;
4690  CYTHON_FALLTHROUGH;
4691  case 1:
4692  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4693  else {
4694  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 139, __pyx_L3_error)
4695  }
4696  CYTHON_FALLTHROUGH;
4697  case 2:
4698  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4699  else {
4700  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 139, __pyx_L3_error)
4701  }
4702  CYTHON_FALLTHROUGH;
4703  case 3:
4704  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4705  else {
4706  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 139, __pyx_L3_error)
4707  }
4708  CYTHON_FALLTHROUGH;
4709  case 4:
4710  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4711  else {
4712  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 139, __pyx_L3_error)
4713  }
4714  }
4715  if (unlikely(kw_args > 0)) {
4716  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 139, __pyx_L3_error)
4717  }
4718  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4719  goto __pyx_L5_argtuple_error;
4720  } else {
4721  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4722  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4723  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4724  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4725  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4726  }
4727  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
4728  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
4729  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
4730  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[3]);
4731  __pyx_v_material_functions = ((PyObject*)values[4]);
4732  }
4733  goto __pyx_L4_argument_unpacking_done;
4734  __pyx_L5_argtuple_error:;
4735  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 139, __pyx_L3_error)
4736  __pyx_L3_error:;
4737  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4738  __Pyx_RefNannyFinishContext();
4739  return NULL;
4740  __pyx_L4_argument_unpacking_done:;
4741  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 140, __pyx_L1_error)
4742  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 141, __pyx_L1_error)
4743  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 142, __pyx_L1_error)
4744  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 143, __pyx_L1_error)
4745  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4746 
4747  /* function exit code */
4748  goto __pyx_L0;
4749  __pyx_L1_error:;
4750  __pyx_r = NULL;
4751  __pyx_L0:;
4752  __Pyx_RefNannyFinishContext();
4753  return __pyx_r;
4754 }
4755 
4756 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4757  int __pyx_v_ebN;
4758  int __pyx_v_k;
4759  int __pyx_v_material_left;
4760  int __pyx_v_material_right;
4761  int __pyx_v_I;
4762  int __pyx_v_J;
4763  double __pyx_v_numer;
4764  double __pyx_v_denom;
4765  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4766  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4767  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4768  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4769  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4770  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4771  PyObject *__pyx_r = NULL;
4772  __Pyx_RefNannyDeclarations
4773  npy_intp __pyx_t_1;
4774  npy_intp __pyx_t_2;
4775  int __pyx_t_3;
4776  Py_ssize_t __pyx_t_4;
4777  Py_ssize_t __pyx_t_5;
4778  int __pyx_t_6;
4779  Py_ssize_t __pyx_t_7;
4780  Py_ssize_t __pyx_t_8;
4781  npy_intp __pyx_t_9;
4782  npy_intp __pyx_t_10;
4783  int __pyx_t_11;
4784  int __pyx_t_12;
4785  int __pyx_t_13;
4786  int __pyx_t_14;
4787  int __pyx_t_15;
4788  int __pyx_t_16;
4789  PyObject *__pyx_t_17 = NULL;
4790  PyObject *__pyx_t_18 = NULL;
4791  PyObject *__pyx_t_19 = NULL;
4792  PyObject *__pyx_t_20 = NULL;
4793  PyObject *__pyx_t_21 = NULL;
4794  double __pyx_t_22;
4795  Py_ssize_t __pyx_t_23;
4796  Py_ssize_t __pyx_t_24;
4797  Py_ssize_t __pyx_t_25;
4798  int __pyx_t_26;
4799  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
4800  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4801  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4802  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4803  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4804  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4805  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4806  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4807  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4808  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4809  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4810  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4811  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4812  {
4813  __Pyx_BufFmt_StackElem __pyx_stack[1];
4814  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4815  }
4816  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4817  {
4818  __Pyx_BufFmt_StackElem __pyx_stack[1];
4819  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4820  }
4821  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4822  {
4823  __Pyx_BufFmt_StackElem __pyx_stack[1];
4824  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4825  }
4826  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
4827 
4828  /* "subsurfaceTransportFunctions.pyx":154
4829  * cdef double numer,denom
4830  *
4831  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4832  * material_left = elementBoundaryTypes[ebN,0]
4833  * material_right= elementBoundaryTypes[ebN,1]
4834  */
4835  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4836  __pyx_t_2 = __pyx_t_1;
4837  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4838  __pyx_v_ebN = __pyx_t_3;
4839 
4840  /* "subsurfaceTransportFunctions.pyx":155
4841  *
4842  * for ebN in range(ebq_global_vals.shape[0]):
4843  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4844  * material_right= elementBoundaryTypes[ebN,1]
4845  * for k in range(ebq_global_vals.shape[1]):
4846  */
4847  __pyx_t_4 = __pyx_v_ebN;
4848  __pyx_t_5 = 0;
4849  __pyx_t_6 = -1;
4850  if (__pyx_t_4 < 0) {
4851  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4852  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4853  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4854  if (__pyx_t_5 < 0) {
4855  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4856  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4857  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4858  if (unlikely(__pyx_t_6 != -1)) {
4859  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4860  __PYX_ERR(0, 155, __pyx_L1_error)
4861  }
4862  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4863 
4864  /* "subsurfaceTransportFunctions.pyx":156
4865  * for ebN in range(ebq_global_vals.shape[0]):
4866  * material_left = elementBoundaryTypes[ebN,0]
4867  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4868  * for k in range(ebq_global_vals.shape[1]):
4869  * for I in range(nd):
4870  */
4871  __pyx_t_7 = __pyx_v_ebN;
4872  __pyx_t_8 = 1;
4873  __pyx_t_6 = -1;
4874  if (__pyx_t_7 < 0) {
4875  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4876  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
4877  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4878  if (__pyx_t_8 < 0) {
4879  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4880  if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 1;
4881  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4882  if (unlikely(__pyx_t_6 != -1)) {
4883  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4884  __PYX_ERR(0, 156, __pyx_L1_error)
4885  }
4886  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4887 
4888  /* "subsurfaceTransportFunctions.pyx":157
4889  * material_left = elementBoundaryTypes[ebN,0]
4890  * material_right= elementBoundaryTypes[ebN,1]
4891  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
4892  * for I in range(nd):
4893  * for J in range(nd):
4894  */
4895  __pyx_t_9 = (__pyx_v_ebq_global_vals->dimensions[1]);
4896  __pyx_t_10 = __pyx_t_9;
4897  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_10; __pyx_t_6+=1) {
4898  __pyx_v_k = __pyx_t_6;
4899 
4900  /* "subsurfaceTransportFunctions.pyx":158
4901  * material_right= elementBoundaryTypes[ebN,1]
4902  * for k in range(ebq_global_vals.shape[1]):
4903  * for I in range(nd): # <<<<<<<<<<<<<<
4904  * for J in range(nd):
4905  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4906  */
4907  __pyx_t_11 = __pyx_v_nd;
4908  __pyx_t_12 = __pyx_t_11;
4909  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
4910  __pyx_v_I = __pyx_t_13;
4911 
4912  /* "subsurfaceTransportFunctions.pyx":159
4913  * for k in range(ebq_global_vals.shape[1]):
4914  * for I in range(nd):
4915  * for J in range(nd): # <<<<<<<<<<<<<<
4916  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4917  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4918  */
4919  __pyx_t_14 = __pyx_v_nd;
4920  __pyx_t_15 = __pyx_t_14;
4921  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
4922  __pyx_v_J = __pyx_t_16;
4923 
4924  /* "subsurfaceTransportFunctions.pyx":160
4925  * for I in range(nd):
4926  * for J in range(nd):
4927  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
4928  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4929  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
4930  */
4931  if (unlikely(__pyx_v_material_functions == Py_None)) {
4932  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4933  __PYX_ERR(0, 160, __pyx_L1_error)
4934  }
4935  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
4936  __Pyx_GOTREF(__pyx_t_17);
4937  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 160, __pyx_L1_error)
4938  __Pyx_GOTREF(__pyx_t_18);
4939  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4940  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
4941  __Pyx_GOTREF(__pyx_t_17);
4942  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
4943  __Pyx_GOTREF(__pyx_t_19);
4944  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 160, __pyx_L1_error)
4945  __Pyx_GOTREF(__pyx_t_20);
4946  __Pyx_GIVEREF(__pyx_t_17);
4947  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_17);
4948  __Pyx_GIVEREF(__pyx_t_19);
4949  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_19);
4950  __pyx_t_17 = 0;
4951  __pyx_t_19 = 0;
4952  __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
4953  __Pyx_GOTREF(__pyx_t_19);
4954  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4955  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4956  __pyx_t_20 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_19); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 160, __pyx_L1_error)
4957  __Pyx_GOTREF(__pyx_t_20);
4958  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4959  if (unlikely(__pyx_v_material_functions == Py_None)) {
4960  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4961  __PYX_ERR(0, 160, __pyx_L1_error)
4962  }
4963  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
4964  __Pyx_GOTREF(__pyx_t_19);
4965  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 160, __pyx_L1_error)
4966  __Pyx_GOTREF(__pyx_t_18);
4967  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4968  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
4969  __Pyx_GOTREF(__pyx_t_19);
4970  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
4971  __Pyx_GOTREF(__pyx_t_17);
4972  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 160, __pyx_L1_error)
4973  __Pyx_GOTREF(__pyx_t_21);
4974  __Pyx_GIVEREF(__pyx_t_19);
4975  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_19);
4976  __Pyx_GIVEREF(__pyx_t_17);
4977  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_17);
4978  __pyx_t_19 = 0;
4979  __pyx_t_17 = 0;
4980  __pyx_t_17 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_21); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
4981  __Pyx_GOTREF(__pyx_t_17);
4982  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4983  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
4984  __pyx_t_21 = PyNumber_Multiply(__pyx_t_20, __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 160, __pyx_L1_error)
4985  __Pyx_GOTREF(__pyx_t_21);
4986  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4987  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4988  __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_21); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error)
4989  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
4990  __pyx_v_numer = __pyx_t_22;
4991 
4992  /* "subsurfaceTransportFunctions.pyx":161
4993  * for J in range(nd):
4994  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4995  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
4996  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
4997  *
4998  */
4999  if (unlikely(__pyx_v_material_functions == Py_None)) {
5000  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5001  __PYX_ERR(0, 161, __pyx_L1_error)
5002  }
5003  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error)
5004  __Pyx_GOTREF(__pyx_t_21);
5005  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_21); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
5006  __Pyx_GOTREF(__pyx_t_17);
5007  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5008  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error)
5009  __Pyx_GOTREF(__pyx_t_21);
5010  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 161, __pyx_L1_error)
5011  __Pyx_GOTREF(__pyx_t_20);
5012  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5013  __Pyx_GOTREF(__pyx_t_18);
5014  __Pyx_GIVEREF(__pyx_t_21);
5015  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_21);
5016  __Pyx_GIVEREF(__pyx_t_20);
5017  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_20);
5018  __pyx_t_21 = 0;
5019  __pyx_t_20 = 0;
5020  __pyx_t_20 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_t_18); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 161, __pyx_L1_error)
5021  __Pyx_GOTREF(__pyx_t_20);
5022  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5023  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5024  if (unlikely(__pyx_v_material_functions == Py_None)) {
5025  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5026  __PYX_ERR(0, 161, __pyx_L1_error)
5027  }
5028  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5029  __Pyx_GOTREF(__pyx_t_18);
5030  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
5031  __Pyx_GOTREF(__pyx_t_17);
5032  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5033  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5034  __Pyx_GOTREF(__pyx_t_18);
5035  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error)
5036  __Pyx_GOTREF(__pyx_t_21);
5037  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5038  __Pyx_GOTREF(__pyx_t_19);
5039  __Pyx_GIVEREF(__pyx_t_18);
5040  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_18);
5041  __Pyx_GIVEREF(__pyx_t_21);
5042  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21);
5043  __pyx_t_18 = 0;
5044  __pyx_t_21 = 0;
5045  __pyx_t_21 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_t_19); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error)
5046  __Pyx_GOTREF(__pyx_t_21);
5047  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5048  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5049  __pyx_t_19 = PyNumber_Add(__pyx_t_20, __pyx_t_21); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5050  __Pyx_GOTREF(__pyx_t_19);
5051  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
5052  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5053  __pyx_t_21 = __Pyx_PyFloat_AddObjC(__pyx_t_19, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error)
5054  __Pyx_GOTREF(__pyx_t_21);
5055  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5056  __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_21); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L1_error)
5057  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5058  __pyx_v_denom = __pyx_t_22;
5059 
5060  /* "subsurfaceTransportFunctions.pyx":162
5061  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5062  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5063  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
5064  *
5065  * ###
5066  */
5067  if (unlikely(__pyx_v_denom == 0)) {
5068  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
5069  __PYX_ERR(0, 162, __pyx_L1_error)
5070  }
5071  __pyx_t_23 = __pyx_v_ebN;
5072  __pyx_t_24 = __pyx_v_k;
5073  __pyx_t_25 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
5074  __pyx_t_26 = -1;
5075  if (__pyx_t_23 < 0) {
5076  __pyx_t_23 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
5077  if (unlikely(__pyx_t_23 < 0)) __pyx_t_26 = 0;
5078  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_26 = 0;
5079  if (__pyx_t_24 < 0) {
5080  __pyx_t_24 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
5081  if (unlikely(__pyx_t_24 < 0)) __pyx_t_26 = 1;
5082  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_26 = 1;
5083  if (__pyx_t_25 < 0) {
5084  __pyx_t_25 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
5085  if (unlikely(__pyx_t_25 < 0)) __pyx_t_26 = 2;
5086  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_26 = 2;
5087  if (unlikely(__pyx_t_26 != -1)) {
5088  __Pyx_RaiseBufferIndexError(__pyx_t_26);
5089  __PYX_ERR(0, 162, __pyx_L1_error)
5090  }
5091  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
5092  }
5093  }
5094  }
5095  }
5096 
5097  /* "subsurfaceTransportFunctions.pyx":139
5098  *
5099  *
5100  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
5101  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5102  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5103  */
5104 
5105  /* function exit code */
5106  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5107  goto __pyx_L0;
5108  __pyx_L1_error:;
5109  __Pyx_XDECREF(__pyx_t_17);
5110  __Pyx_XDECREF(__pyx_t_18);
5111  __Pyx_XDECREF(__pyx_t_19);
5112  __Pyx_XDECREF(__pyx_t_20);
5113  __Pyx_XDECREF(__pyx_t_21);
5114  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5115  __Pyx_PyThreadState_declare
5116  __Pyx_PyThreadState_assign
5117  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5118  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
5119  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5120  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5121  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5122  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
5123  __pyx_r = NULL;
5124  goto __pyx_L2;
5125  __pyx_L0:;
5126  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
5127  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5128  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5129  __pyx_L2:;
5130  __Pyx_XGIVEREF(__pyx_r);
5131  __Pyx_RefNannyFinishContext();
5132  return __pyx_r;
5133 }
5134 
5135 /* "subsurfaceTransportFunctions.pyx":165
5136  *
5137  * ###
5138  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5139  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5140  * numpy.ndarray[DTYPE_t,ndim=3] x,
5141  */
5142 
5143 /* Python wrapper */
5144 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5145 static char __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function f_j(x,t) assuming element is material j\n likely little improvement right now without correct typing of material_functions\n ";
5146 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements = {"evaluateScalarMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements};
5147 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5148  double __pyx_v_t;
5149  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
5150  PyArrayObject *__pyx_v_x = 0;
5151  PyArrayObject *__pyx_v_q_vals = 0;
5152  PyObject *__pyx_v_material_functions = 0;
5153  PyObject *__pyx_r = 0;
5154  __Pyx_RefNannyDeclarations
5155  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements (wrapper)", 0);
5156  {
5157  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
5158  PyObject* values[5] = {0,0,0,0,0};
5159  if (unlikely(__pyx_kwds)) {
5160  Py_ssize_t kw_args;
5161  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5162  switch (pos_args) {
5163  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5164  CYTHON_FALLTHROUGH;
5165  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5166  CYTHON_FALLTHROUGH;
5167  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5168  CYTHON_FALLTHROUGH;
5169  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5170  CYTHON_FALLTHROUGH;
5171  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5172  CYTHON_FALLTHROUGH;
5173  case 0: break;
5174  default: goto __pyx_L5_argtuple_error;
5175  }
5176  kw_args = PyDict_Size(__pyx_kwds);
5177  switch (pos_args) {
5178  case 0:
5179  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5180  else goto __pyx_L5_argtuple_error;
5181  CYTHON_FALLTHROUGH;
5182  case 1:
5183  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
5184  else {
5185  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 165, __pyx_L3_error)
5186  }
5187  CYTHON_FALLTHROUGH;
5188  case 2:
5189  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5190  else {
5191  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 165, __pyx_L3_error)
5192  }
5193  CYTHON_FALLTHROUGH;
5194  case 3:
5195  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
5196  else {
5197  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 165, __pyx_L3_error)
5198  }
5199  CYTHON_FALLTHROUGH;
5200  case 4:
5201  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5202  else {
5203  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 165, __pyx_L3_error)
5204  }
5205  }
5206  if (unlikely(kw_args > 0)) {
5207  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 165, __pyx_L3_error)
5208  }
5209  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5210  goto __pyx_L5_argtuple_error;
5211  } else {
5212  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5213  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5214  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5215  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5216  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5217  }
5218  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error)
5219  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5220  __pyx_v_x = ((PyArrayObject *)values[2]);
5221  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5222  __pyx_v_material_functions = ((PyObject*)values[4]);
5223  }
5224  goto __pyx_L4_argument_unpacking_done;
5225  __pyx_L5_argtuple_error:;
5226  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 165, __pyx_L3_error)
5227  __pyx_L3_error:;
5228  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5229  __Pyx_RefNannyFinishContext();
5230  return NULL;
5231  __pyx_L4_argument_unpacking_done:;
5232  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 166, __pyx_L1_error)
5233  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 167, __pyx_L1_error)
5234  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 168, __pyx_L1_error)
5235  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 169, __pyx_L1_error)
5236  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5237 
5238  /* function exit code */
5239  goto __pyx_L0;
5240  __pyx_L1_error:;
5241  __pyx_r = NULL;
5242  __pyx_L0:;
5243  __Pyx_RefNannyFinishContext();
5244  return __pyx_r;
5245 }
5246 
5247 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5248  int __pyx_v_eN;
5249  int __pyx_v_k;
5250  int __pyx_v_material;
5251  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5252  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5253  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5254  __Pyx_Buffer __pyx_pybuffer_q_vals;
5255  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5256  __Pyx_Buffer __pyx_pybuffer_x;
5257  PyObject *__pyx_r = NULL;
5258  __Pyx_RefNannyDeclarations
5259  npy_intp __pyx_t_1;
5260  npy_intp __pyx_t_2;
5261  int __pyx_t_3;
5262  Py_ssize_t __pyx_t_4;
5263  int __pyx_t_5;
5264  npy_intp __pyx_t_6;
5265  npy_intp __pyx_t_7;
5266  PyObject *__pyx_t_8 = NULL;
5267  PyObject *__pyx_t_9 = NULL;
5268  PyObject *__pyx_t_10 = NULL;
5269  PyObject *__pyx_t_11 = NULL;
5270  PyObject *__pyx_t_12 = NULL;
5271  int __pyx_t_13;
5272  PyObject *__pyx_t_14 = NULL;
5273  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
5274  Py_ssize_t __pyx_t_16;
5275  Py_ssize_t __pyx_t_17;
5276  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements", 0);
5277  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5278  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5279  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5280  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5281  __pyx_pybuffer_x.pybuffer.buf = NULL;
5282  __pyx_pybuffer_x.refcount = 0;
5283  __pyx_pybuffernd_x.data = NULL;
5284  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5285  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5286  __pyx_pybuffer_q_vals.refcount = 0;
5287  __pyx_pybuffernd_q_vals.data = NULL;
5288  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5289  {
5290  __Pyx_BufFmt_StackElem __pyx_stack[1];
5291  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5292  }
5293  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5294  {
5295  __Pyx_BufFmt_StackElem __pyx_stack[1];
5296  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5297  }
5298  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5299  {
5300  __Pyx_BufFmt_StackElem __pyx_stack[1];
5301  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5302  }
5303  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
5304 
5305  /* "subsurfaceTransportFunctions.pyx":175
5306  * """
5307  * cdef int eN,k,material
5308  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5309  * material = elementMaterialTypes[eN]
5310  * for k in range(x.shape[1]):
5311  */
5312  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5313  __pyx_t_2 = __pyx_t_1;
5314  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5315  __pyx_v_eN = __pyx_t_3;
5316 
5317  /* "subsurfaceTransportFunctions.pyx":176
5318  * cdef int eN,k,material
5319  * for eN in range(x.shape[0]):
5320  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5321  * for k in range(x.shape[1]):
5322  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5323  */
5324  __pyx_t_4 = __pyx_v_eN;
5325  __pyx_t_5 = -1;
5326  if (__pyx_t_4 < 0) {
5327  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5328  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
5329  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
5330  if (unlikely(__pyx_t_5 != -1)) {
5331  __Pyx_RaiseBufferIndexError(__pyx_t_5);
5332  __PYX_ERR(0, 176, __pyx_L1_error)
5333  }
5334  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5335 
5336  /* "subsurfaceTransportFunctions.pyx":177
5337  * for eN in range(x.shape[0]):
5338  * material = elementMaterialTypes[eN]
5339  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5340  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5341  *
5342  */
5343  __pyx_t_6 = (__pyx_v_x->dimensions[1]);
5344  __pyx_t_7 = __pyx_t_6;
5345  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
5346  __pyx_v_k = __pyx_t_5;
5347 
5348  /* "subsurfaceTransportFunctions.pyx":178
5349  * material = elementMaterialTypes[eN]
5350  * for k in range(x.shape[1]):
5351  * q_vals[eN,k] = material_functions[material](x[eN,k],t) # <<<<<<<<<<<<<<
5352  *
5353  * def evaluateVectorMaterialFunctionOverElements(double t,
5354  */
5355  if (unlikely(__pyx_v_material_functions == Py_None)) {
5356  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5357  __PYX_ERR(0, 178, __pyx_L1_error)
5358  }
5359  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5360  __Pyx_GOTREF(__pyx_t_9);
5361  __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 178, __pyx_L1_error)
5362  __Pyx_GOTREF(__pyx_t_10);
5363  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5364  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5365  __Pyx_GOTREF(__pyx_t_9);
5366  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error)
5367  __Pyx_GOTREF(__pyx_t_11);
5368  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error)
5369  __Pyx_GOTREF(__pyx_t_12);
5370  __Pyx_GIVEREF(__pyx_t_9);
5371  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
5372  __Pyx_GIVEREF(__pyx_t_11);
5373  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
5374  __pyx_t_9 = 0;
5375  __pyx_t_11 = 0;
5376  __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error)
5377  __Pyx_GOTREF(__pyx_t_11);
5378  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5379  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error)
5380  __Pyx_GOTREF(__pyx_t_12);
5381  __pyx_t_9 = NULL;
5382  __pyx_t_13 = 0;
5383  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
5384  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
5385  if (likely(__pyx_t_9)) {
5386  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5387  __Pyx_INCREF(__pyx_t_9);
5388  __Pyx_INCREF(function);
5389  __Pyx_DECREF_SET(__pyx_t_10, function);
5390  __pyx_t_13 = 1;
5391  }
5392  }
5393  #if CYTHON_FAST_PYCALL
5394  if (PyFunction_Check(__pyx_t_10)) {
5395  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5396  __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5397  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5398  __Pyx_GOTREF(__pyx_t_8);
5399  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5400  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5401  } else
5402  #endif
5403  #if CYTHON_FAST_PYCCALL
5404  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
5405  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5406  __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5407  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5408  __Pyx_GOTREF(__pyx_t_8);
5409  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5410  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5411  } else
5412  #endif
5413  {
5414  __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 178, __pyx_L1_error)
5415  __Pyx_GOTREF(__pyx_t_14);
5416  if (__pyx_t_9) {
5417  __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
5418  }
5419  __Pyx_GIVEREF(__pyx_t_11);
5420  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_11);
5421  __Pyx_GIVEREF(__pyx_t_12);
5422  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_12);
5423  __pyx_t_11 = 0;
5424  __pyx_t_12 = 0;
5425  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5426  __Pyx_GOTREF(__pyx_t_8);
5427  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5428  }
5429  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5430  __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_15 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error)
5431  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5432  __pyx_t_16 = __pyx_v_eN;
5433  __pyx_t_17 = __pyx_v_k;
5434  __pyx_t_13 = -1;
5435  if (__pyx_t_16 < 0) {
5436  __pyx_t_16 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
5437  if (unlikely(__pyx_t_16 < 0)) __pyx_t_13 = 0;
5438  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_13 = 0;
5439  if (__pyx_t_17 < 0) {
5440  __pyx_t_17 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
5441  if (unlikely(__pyx_t_17 < 0)) __pyx_t_13 = 1;
5442  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_13 = 1;
5443  if (unlikely(__pyx_t_13 != -1)) {
5444  __Pyx_RaiseBufferIndexError(__pyx_t_13);
5445  __PYX_ERR(0, 178, __pyx_L1_error)
5446  }
5447  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_15;
5448  }
5449  }
5450 
5451  /* "subsurfaceTransportFunctions.pyx":165
5452  *
5453  * ###
5454  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5455  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5456  * numpy.ndarray[DTYPE_t,ndim=3] x,
5457  */
5458 
5459  /* function exit code */
5460  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5461  goto __pyx_L0;
5462  __pyx_L1_error:;
5463  __Pyx_XDECREF(__pyx_t_8);
5464  __Pyx_XDECREF(__pyx_t_9);
5465  __Pyx_XDECREF(__pyx_t_10);
5466  __Pyx_XDECREF(__pyx_t_11);
5467  __Pyx_XDECREF(__pyx_t_12);
5468  __Pyx_XDECREF(__pyx_t_14);
5469  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5470  __Pyx_PyThreadState_declare
5471  __Pyx_PyThreadState_assign
5472  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5473  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5474  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5475  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5476  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5477  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5478  __pyx_r = NULL;
5479  goto __pyx_L2;
5480  __pyx_L0:;
5481  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5482  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5483  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5484  __pyx_L2:;
5485  __Pyx_XGIVEREF(__pyx_r);
5486  __Pyx_RefNannyFinishContext();
5487  return __pyx_r;
5488 }
5489 
5490 /* "subsurfaceTransportFunctions.pyx":180
5491  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5492  *
5493  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5494  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5495  * numpy.ndarray[DTYPE_t,ndim=3] x,
5496  */
5497 
5498 /* Python wrapper */
5499 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5500 static char __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function \013ec f_j(x,t) assuming element is material j\n ";
5501 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements = {"evaluateVectorMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements};
5502 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5503  double __pyx_v_t;
5504  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
5505  PyArrayObject *__pyx_v_x = 0;
5506  PyArrayObject *__pyx_v_q_vals = 0;
5507  PyObject *__pyx_v_material_functions = 0;
5508  PyObject *__pyx_r = 0;
5509  __Pyx_RefNannyDeclarations
5510  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements (wrapper)", 0);
5511  {
5512  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
5513  PyObject* values[5] = {0,0,0,0,0};
5514  if (unlikely(__pyx_kwds)) {
5515  Py_ssize_t kw_args;
5516  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5517  switch (pos_args) {
5518  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5519  CYTHON_FALLTHROUGH;
5520  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5521  CYTHON_FALLTHROUGH;
5522  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5523  CYTHON_FALLTHROUGH;
5524  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5525  CYTHON_FALLTHROUGH;
5526  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5527  CYTHON_FALLTHROUGH;
5528  case 0: break;
5529  default: goto __pyx_L5_argtuple_error;
5530  }
5531  kw_args = PyDict_Size(__pyx_kwds);
5532  switch (pos_args) {
5533  case 0:
5534  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5535  else goto __pyx_L5_argtuple_error;
5536  CYTHON_FALLTHROUGH;
5537  case 1:
5538  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
5539  else {
5540  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 180, __pyx_L3_error)
5541  }
5542  CYTHON_FALLTHROUGH;
5543  case 2:
5544  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5545  else {
5546  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 180, __pyx_L3_error)
5547  }
5548  CYTHON_FALLTHROUGH;
5549  case 3:
5550  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
5551  else {
5552  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 180, __pyx_L3_error)
5553  }
5554  CYTHON_FALLTHROUGH;
5555  case 4:
5556  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5557  else {
5558  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 180, __pyx_L3_error)
5559  }
5560  }
5561  if (unlikely(kw_args > 0)) {
5562  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 180, __pyx_L3_error)
5563  }
5564  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5565  goto __pyx_L5_argtuple_error;
5566  } else {
5567  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5568  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5569  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5570  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5571  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5572  }
5573  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error)
5574  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5575  __pyx_v_x = ((PyArrayObject *)values[2]);
5576  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5577  __pyx_v_material_functions = ((PyObject*)values[4]);
5578  }
5579  goto __pyx_L4_argument_unpacking_done;
5580  __pyx_L5_argtuple_error:;
5581  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 180, __pyx_L3_error)
5582  __pyx_L3_error:;
5583  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5584  __Pyx_RefNannyFinishContext();
5585  return NULL;
5586  __pyx_L4_argument_unpacking_done:;
5587  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 181, __pyx_L1_error)
5588  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 182, __pyx_L1_error)
5589  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 183, __pyx_L1_error)
5590  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 184, __pyx_L1_error)
5591  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5592 
5593  /* function exit code */
5594  goto __pyx_L0;
5595  __pyx_L1_error:;
5596  __pyx_r = NULL;
5597  __pyx_L0:;
5598  __Pyx_RefNannyFinishContext();
5599  return __pyx_r;
5600 }
5601 
5602 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5603  int __pyx_v_eN;
5604  int __pyx_v_k;
5605  int __pyx_v_material;
5606  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5607  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5608  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5609  __Pyx_Buffer __pyx_pybuffer_q_vals;
5610  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5611  __Pyx_Buffer __pyx_pybuffer_x;
5612  PyObject *__pyx_r = NULL;
5613  __Pyx_RefNannyDeclarations
5614  npy_intp __pyx_t_1;
5615  npy_intp __pyx_t_2;
5616  int __pyx_t_3;
5617  Py_ssize_t __pyx_t_4;
5618  int __pyx_t_5;
5619  npy_intp __pyx_t_6;
5620  npy_intp __pyx_t_7;
5621  PyObject *__pyx_t_8 = NULL;
5622  PyObject *__pyx_t_9 = NULL;
5623  PyObject *__pyx_t_10 = NULL;
5624  PyObject *__pyx_t_11 = NULL;
5625  PyObject *__pyx_t_12 = NULL;
5626  int __pyx_t_13;
5627  PyObject *__pyx_t_14 = NULL;
5628  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements", 0);
5629  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5630  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5631  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5632  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5633  __pyx_pybuffer_x.pybuffer.buf = NULL;
5634  __pyx_pybuffer_x.refcount = 0;
5635  __pyx_pybuffernd_x.data = NULL;
5636  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5637  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5638  __pyx_pybuffer_q_vals.refcount = 0;
5639  __pyx_pybuffernd_q_vals.data = NULL;
5640  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5641  {
5642  __Pyx_BufFmt_StackElem __pyx_stack[1];
5643  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5644  }
5645  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5646  {
5647  __Pyx_BufFmt_StackElem __pyx_stack[1];
5648  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5649  }
5650  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5651  {
5652  __Pyx_BufFmt_StackElem __pyx_stack[1];
5653  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5654  }
5655  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
5656 
5657  /* "subsurfaceTransportFunctions.pyx":189
5658  * """
5659  * cdef int eN,k,material
5660  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5661  * material = elementMaterialTypes[eN]
5662  * for k in range(x.shape[1]):
5663  */
5664  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5665  __pyx_t_2 = __pyx_t_1;
5666  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5667  __pyx_v_eN = __pyx_t_3;
5668 
5669  /* "subsurfaceTransportFunctions.pyx":190
5670  * cdef int eN,k,material
5671  * for eN in range(x.shape[0]):
5672  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5673  * for k in range(x.shape[1]):
5674  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5675  */
5676  __pyx_t_4 = __pyx_v_eN;
5677  __pyx_t_5 = -1;
5678  if (__pyx_t_4 < 0) {
5679  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5680  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
5681  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
5682  if (unlikely(__pyx_t_5 != -1)) {
5683  __Pyx_RaiseBufferIndexError(__pyx_t_5);
5684  __PYX_ERR(0, 190, __pyx_L1_error)
5685  }
5686  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5687 
5688  /* "subsurfaceTransportFunctions.pyx":191
5689  * for eN in range(x.shape[0]):
5690  * material = elementMaterialTypes[eN]
5691  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5692  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5693  *
5694  */
5695  __pyx_t_6 = (__pyx_v_x->dimensions[1]);
5696  __pyx_t_7 = __pyx_t_6;
5697  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
5698  __pyx_v_k = __pyx_t_5;
5699 
5700  /* "subsurfaceTransportFunctions.pyx":192
5701  * material = elementMaterialTypes[eN]
5702  * for k in range(x.shape[1]):
5703  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat # <<<<<<<<<<<<<<
5704  *
5705  *
5706  */
5707  if (unlikely(__pyx_v_material_functions == Py_None)) {
5708  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5709  __PYX_ERR(0, 192, __pyx_L1_error)
5710  }
5711  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5712  __Pyx_GOTREF(__pyx_t_9);
5713  __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5714  __Pyx_GOTREF(__pyx_t_10);
5715  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5716  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5717  __Pyx_GOTREF(__pyx_t_9);
5718  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 192, __pyx_L1_error)
5719  __Pyx_GOTREF(__pyx_t_11);
5720  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5721  __Pyx_GOTREF(__pyx_t_12);
5722  __Pyx_GIVEREF(__pyx_t_9);
5723  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
5724  __Pyx_GIVEREF(__pyx_t_11);
5725  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
5726  __pyx_t_9 = 0;
5727  __pyx_t_11 = 0;
5728  __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 192, __pyx_L1_error)
5729  __Pyx_GOTREF(__pyx_t_11);
5730  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5731  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5732  __Pyx_GOTREF(__pyx_t_12);
5733  __pyx_t_9 = NULL;
5734  __pyx_t_13 = 0;
5735  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
5736  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
5737  if (likely(__pyx_t_9)) {
5738  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5739  __Pyx_INCREF(__pyx_t_9);
5740  __Pyx_INCREF(function);
5741  __Pyx_DECREF_SET(__pyx_t_10, function);
5742  __pyx_t_13 = 1;
5743  }
5744  }
5745  #if CYTHON_FAST_PYCALL
5746  if (PyFunction_Check(__pyx_t_10)) {
5747  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5748  __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5749  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5750  __Pyx_GOTREF(__pyx_t_8);
5751  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5752  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5753  } else
5754  #endif
5755  #if CYTHON_FAST_PYCCALL
5756  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
5757  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5758  __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5759  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5760  __Pyx_GOTREF(__pyx_t_8);
5761  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5762  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5763  } else
5764  #endif
5765  {
5766  __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 192, __pyx_L1_error)
5767  __Pyx_GOTREF(__pyx_t_14);
5768  if (__pyx_t_9) {
5769  __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
5770  }
5771  __Pyx_GIVEREF(__pyx_t_11);
5772  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_11);
5773  __Pyx_GIVEREF(__pyx_t_12);
5774  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_12);
5775  __pyx_t_11 = 0;
5776  __pyx_t_12 = 0;
5777  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5778  __Pyx_GOTREF(__pyx_t_8);
5779  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5780  }
5781  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5782  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_flat); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5783  __Pyx_GOTREF(__pyx_t_10);
5784  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5785  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5786  __Pyx_GOTREF(__pyx_t_8);
5787  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 192, __pyx_L1_error)
5788  __Pyx_GOTREF(__pyx_t_14);
5789  __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5790  __Pyx_GOTREF(__pyx_t_12);
5791  __Pyx_GIVEREF(__pyx_t_8);
5792  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8);
5793  __Pyx_GIVEREF(__pyx_t_14);
5794  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_14);
5795  __Pyx_INCREF(__pyx_slice__2);
5796  __Pyx_GIVEREF(__pyx_slice__2);
5797  PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_slice__2);
5798  __pyx_t_8 = 0;
5799  __pyx_t_14 = 0;
5800  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_12, __pyx_t_10) < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
5801  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5802  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5803  }
5804  }
5805 
5806  /* "subsurfaceTransportFunctions.pyx":180
5807  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5808  *
5809  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5810  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5811  * numpy.ndarray[DTYPE_t,ndim=3] x,
5812  */
5813 
5814  /* function exit code */
5815  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5816  goto __pyx_L0;
5817  __pyx_L1_error:;
5818  __Pyx_XDECREF(__pyx_t_8);
5819  __Pyx_XDECREF(__pyx_t_9);
5820  __Pyx_XDECREF(__pyx_t_10);
5821  __Pyx_XDECREF(__pyx_t_11);
5822  __Pyx_XDECREF(__pyx_t_12);
5823  __Pyx_XDECREF(__pyx_t_14);
5824  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5825  __Pyx_PyThreadState_declare
5826  __Pyx_PyThreadState_assign
5827  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5828  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5829  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5830  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5831  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5832  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5833  __pyx_r = NULL;
5834  goto __pyx_L2;
5835  __pyx_L0:;
5836  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5837  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5838  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5839  __pyx_L2:;
5840  __Pyx_XGIVEREF(__pyx_r);
5841  __Pyx_RefNannyFinishContext();
5842  return __pyx_r;
5843 }
5844 
5845 /* "subsurfaceTransportFunctions.pyx":195
5846  *
5847  *
5848  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
5849  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5850  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5851  */
5852 
5853 /* Python wrapper */
5854 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5855 static char __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
5856 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
5857 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5858  double __pyx_v_t;
5859  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
5860  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
5861  PyArrayObject *__pyx_v_x = 0;
5862  PyArrayObject *__pyx_v_ebq_vals = 0;
5863  PyObject *__pyx_v_material_functions = 0;
5864  PyObject *__pyx_r = 0;
5865  __Pyx_RefNannyDeclarations
5866  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
5867  {
5868  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
5869  PyObject* values[6] = {0,0,0,0,0,0};
5870  if (unlikely(__pyx_kwds)) {
5871  Py_ssize_t kw_args;
5872  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5873  switch (pos_args) {
5874  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5875  CYTHON_FALLTHROUGH;
5876  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5877  CYTHON_FALLTHROUGH;
5878  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5879  CYTHON_FALLTHROUGH;
5880  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5881  CYTHON_FALLTHROUGH;
5882  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5883  CYTHON_FALLTHROUGH;
5884  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5885  CYTHON_FALLTHROUGH;
5886  case 0: break;
5887  default: goto __pyx_L5_argtuple_error;
5888  }
5889  kw_args = PyDict_Size(__pyx_kwds);
5890  switch (pos_args) {
5891  case 0:
5892  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5893  else goto __pyx_L5_argtuple_error;
5894  CYTHON_FALLTHROUGH;
5895  case 1:
5896  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
5897  else {
5898  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 195, __pyx_L3_error)
5899  }
5900  CYTHON_FALLTHROUGH;
5901  case 2:
5902  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
5903  else {
5904  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 195, __pyx_L3_error)
5905  }
5906  CYTHON_FALLTHROUGH;
5907  case 3:
5908  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5909  else {
5910  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 195, __pyx_L3_error)
5911  }
5912  CYTHON_FALLTHROUGH;
5913  case 4:
5914  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
5915  else {
5916  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 195, __pyx_L3_error)
5917  }
5918  CYTHON_FALLTHROUGH;
5919  case 5:
5920  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5921  else {
5922  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 195, __pyx_L3_error)
5923  }
5924  }
5925  if (unlikely(kw_args > 0)) {
5926  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 195, __pyx_L3_error)
5927  }
5928  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
5929  goto __pyx_L5_argtuple_error;
5930  } else {
5931  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5932  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5933  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5934  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5935  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5936  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5937  }
5938  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error)
5939  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
5940  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
5941  __pyx_v_x = ((PyArrayObject *)values[3]);
5942  __pyx_v_ebq_vals = ((PyArrayObject *)values[4]);
5943  __pyx_v_material_functions = ((PyObject*)values[5]);
5944  }
5945  goto __pyx_L4_argument_unpacking_done;
5946  __pyx_L5_argtuple_error:;
5947  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 195, __pyx_L3_error)
5948  __pyx_L3_error:;
5949  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
5950  __Pyx_RefNannyFinishContext();
5951  return NULL;
5952  __pyx_L4_argument_unpacking_done:;
5953  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 196, __pyx_L1_error)
5954  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 197, __pyx_L1_error)
5955  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 198, __pyx_L1_error)
5956  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 199, __pyx_L1_error)
5957  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 200, __pyx_L1_error)
5958  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
5959 
5960  /* function exit code */
5961  goto __pyx_L0;
5962  __pyx_L1_error:;
5963  __pyx_r = NULL;
5964  __pyx_L0:;
5965  __Pyx_RefNannyFinishContext();
5966  return __pyx_r;
5967 }
5968 
5969 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
5970  int __pyx_v_eN;
5971  int __pyx_v_ebN;
5972  int __pyx_v_ebN_local;
5973  int __pyx_v_k;
5974  int __pyx_v_material_left;
5975  int __pyx_v_material_right;
5976  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
5977  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
5978  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
5979  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
5980  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
5981  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
5982  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5983  __Pyx_Buffer __pyx_pybuffer_x;
5984  PyObject *__pyx_r = NULL;
5985  __Pyx_RefNannyDeclarations
5986  npy_intp __pyx_t_1;
5987  npy_intp __pyx_t_2;
5988  int __pyx_t_3;
5989  npy_intp __pyx_t_4;
5990  npy_intp __pyx_t_5;
5991  int __pyx_t_6;
5992  Py_ssize_t __pyx_t_7;
5993  Py_ssize_t __pyx_t_8;
5994  int __pyx_t_9;
5995  Py_ssize_t __pyx_t_10;
5996  Py_ssize_t __pyx_t_11;
5997  Py_ssize_t __pyx_t_12;
5998  Py_ssize_t __pyx_t_13;
5999  npy_intp __pyx_t_14;
6000  npy_intp __pyx_t_15;
6001  PyObject *__pyx_t_16 = NULL;
6002  PyObject *__pyx_t_17 = NULL;
6003  PyObject *__pyx_t_18 = NULL;
6004  PyObject *__pyx_t_19 = NULL;
6005  PyObject *__pyx_t_20 = NULL;
6006  PyObject *__pyx_t_21 = NULL;
6007  int __pyx_t_22;
6008  PyObject *__pyx_t_23 = NULL;
6009  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_24;
6010  Py_ssize_t __pyx_t_25;
6011  Py_ssize_t __pyx_t_26;
6012  Py_ssize_t __pyx_t_27;
6013  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
6014  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6015  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6016  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6017  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6018  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6019  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6020  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6021  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6022  __pyx_pybuffer_x.pybuffer.buf = NULL;
6023  __pyx_pybuffer_x.refcount = 0;
6024  __pyx_pybuffernd_x.data = NULL;
6025  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6026  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
6027  __pyx_pybuffer_ebq_vals.refcount = 0;
6028  __pyx_pybuffernd_ebq_vals.data = NULL;
6029  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
6030  {
6031  __Pyx_BufFmt_StackElem __pyx_stack[1];
6032  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6033  }
6034  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
6035  {
6036  __Pyx_BufFmt_StackElem __pyx_stack[1];
6037  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6038  }
6039  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
6040  {
6041  __Pyx_BufFmt_StackElem __pyx_stack[1];
6042  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6043  }
6044  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
6045  {
6046  __Pyx_BufFmt_StackElem __pyx_stack[1];
6047  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6048  }
6049  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
6050 
6051  /* "subsurfaceTransportFunctions.pyx":210
6052  * cdef int eN,ebN,ebN_local,k,material_left,material_right
6053  *
6054  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
6055  * for ebN_local in range(x.shape[1]):
6056  * ebN = elementBoundariesArray[eN,ebN_local]
6057  */
6058  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
6059  __pyx_t_2 = __pyx_t_1;
6060  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6061  __pyx_v_eN = __pyx_t_3;
6062 
6063  /* "subsurfaceTransportFunctions.pyx":211
6064  *
6065  * for eN in range(x.shape[0]):
6066  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6067  * ebN = elementBoundariesArray[eN,ebN_local]
6068  * material_left = elementBoundaryTypes[ebN,0]
6069  */
6070  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
6071  __pyx_t_5 = __pyx_t_4;
6072  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6073  __pyx_v_ebN_local = __pyx_t_6;
6074 
6075  /* "subsurfaceTransportFunctions.pyx":212
6076  * for eN in range(x.shape[0]):
6077  * for ebN_local in range(x.shape[1]):
6078  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6079  * material_left = elementBoundaryTypes[ebN,0]
6080  * material_right= elementBoundaryTypes[ebN,1]
6081  */
6082  __pyx_t_7 = __pyx_v_eN;
6083  __pyx_t_8 = __pyx_v_ebN_local;
6084  __pyx_t_9 = -1;
6085  if (__pyx_t_7 < 0) {
6086  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6087  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6088  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
6089  if (__pyx_t_8 < 0) {
6090  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6091  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6092  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
6093  if (unlikely(__pyx_t_9 != -1)) {
6094  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6095  __PYX_ERR(0, 212, __pyx_L1_error)
6096  }
6097  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
6098 
6099  /* "subsurfaceTransportFunctions.pyx":213
6100  * for ebN_local in range(x.shape[1]):
6101  * ebN = elementBoundariesArray[eN,ebN_local]
6102  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6103  * material_right= elementBoundaryTypes[ebN,1]
6104  * for k in range(x.shape[2]):
6105  */
6106  __pyx_t_10 = __pyx_v_ebN;
6107  __pyx_t_11 = 0;
6108  __pyx_t_9 = -1;
6109  if (__pyx_t_10 < 0) {
6110  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6111  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
6112  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6113  if (__pyx_t_11 < 0) {
6114  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6115  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
6116  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6117  if (unlikely(__pyx_t_9 != -1)) {
6118  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6119  __PYX_ERR(0, 213, __pyx_L1_error)
6120  }
6121  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6122 
6123  /* "subsurfaceTransportFunctions.pyx":214
6124  * ebN = elementBoundariesArray[eN,ebN_local]
6125  * material_left = elementBoundaryTypes[ebN,0]
6126  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6127  * for k in range(x.shape[2]):
6128  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6129  */
6130  __pyx_t_12 = __pyx_v_ebN;
6131  __pyx_t_13 = 1;
6132  __pyx_t_9 = -1;
6133  if (__pyx_t_12 < 0) {
6134  __pyx_t_12 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6135  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
6136  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6137  if (__pyx_t_13 < 0) {
6138  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6139  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
6140  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6141  if (unlikely(__pyx_t_9 != -1)) {
6142  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6143  __PYX_ERR(0, 214, __pyx_L1_error)
6144  }
6145  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6146 
6147  /* "subsurfaceTransportFunctions.pyx":215
6148  * material_left = elementBoundaryTypes[ebN,0]
6149  * material_right= elementBoundaryTypes[ebN,1]
6150  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6151  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6152  * material_functions[material_right](x[eN,ebN_local,k],t))
6153  */
6154  __pyx_t_14 = (__pyx_v_x->dimensions[2]);
6155  __pyx_t_15 = __pyx_t_14;
6156  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_15; __pyx_t_9+=1) {
6157  __pyx_v_k = __pyx_t_9;
6158 
6159  /* "subsurfaceTransportFunctions.pyx":216
6160  * material_right= elementBoundaryTypes[ebN,1]
6161  * for k in range(x.shape[2]):
6162  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
6163  * material_functions[material_right](x[eN,ebN_local,k],t))
6164  *
6165  */
6166  if (unlikely(__pyx_v_material_functions == Py_None)) {
6167  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6168  __PYX_ERR(0, 216, __pyx_L1_error)
6169  }
6170  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6171  __Pyx_GOTREF(__pyx_t_17);
6172  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 216, __pyx_L1_error)
6173  __Pyx_GOTREF(__pyx_t_18);
6174  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6175  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6176  __Pyx_GOTREF(__pyx_t_17);
6177  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 216, __pyx_L1_error)
6178  __Pyx_GOTREF(__pyx_t_19);
6179  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 216, __pyx_L1_error)
6180  __Pyx_GOTREF(__pyx_t_20);
6181  __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 216, __pyx_L1_error)
6182  __Pyx_GOTREF(__pyx_t_21);
6183  __Pyx_GIVEREF(__pyx_t_17);
6184  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_17);
6185  __Pyx_GIVEREF(__pyx_t_19);
6186  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_19);
6187  __Pyx_GIVEREF(__pyx_t_20);
6188  PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_20);
6189  __pyx_t_17 = 0;
6190  __pyx_t_19 = 0;
6191  __pyx_t_20 = 0;
6192  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 216, __pyx_L1_error)
6193  __Pyx_GOTREF(__pyx_t_20);
6194  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6195  __pyx_t_21 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 216, __pyx_L1_error)
6196  __Pyx_GOTREF(__pyx_t_21);
6197  __pyx_t_19 = NULL;
6198  __pyx_t_22 = 0;
6199  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
6200  __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_18);
6201  if (likely(__pyx_t_19)) {
6202  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
6203  __Pyx_INCREF(__pyx_t_19);
6204  __Pyx_INCREF(function);
6205  __Pyx_DECREF_SET(__pyx_t_18, function);
6206  __pyx_t_22 = 1;
6207  }
6208  }
6209  #if CYTHON_FAST_PYCALL
6210  if (PyFunction_Check(__pyx_t_18)) {
6211  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_20, __pyx_t_21};
6212  __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6213  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
6214  __Pyx_GOTREF(__pyx_t_16);
6215  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6216  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6217  } else
6218  #endif
6219  #if CYTHON_FAST_PYCCALL
6220  if (__Pyx_PyFastCFunction_Check(__pyx_t_18)) {
6221  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_20, __pyx_t_21};
6222  __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6223  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
6224  __Pyx_GOTREF(__pyx_t_16);
6225  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6226  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6227  } else
6228  #endif
6229  {
6230  __pyx_t_17 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6231  __Pyx_GOTREF(__pyx_t_17);
6232  if (__pyx_t_19) {
6233  __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_19); __pyx_t_19 = NULL;
6234  }
6235  __Pyx_GIVEREF(__pyx_t_20);
6236  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_22, __pyx_t_20);
6237  __Pyx_GIVEREF(__pyx_t_21);
6238  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_22, __pyx_t_21);
6239  __pyx_t_20 = 0;
6240  __pyx_t_21 = 0;
6241  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_17, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6242  __Pyx_GOTREF(__pyx_t_16);
6243  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6244  }
6245  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6246 
6247  /* "subsurfaceTransportFunctions.pyx":217
6248  * for k in range(x.shape[2]):
6249  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6250  * material_functions[material_right](x[eN,ebN_local,k],t)) # <<<<<<<<<<<<<<
6251  *
6252  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
6253  */
6254  if (unlikely(__pyx_v_material_functions == Py_None)) {
6255  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6256  __PYX_ERR(0, 217, __pyx_L1_error)
6257  }
6258  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 217, __pyx_L1_error)
6259  __Pyx_GOTREF(__pyx_t_17);
6260  __pyx_t_21 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 217, __pyx_L1_error)
6261  __Pyx_GOTREF(__pyx_t_21);
6262  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6263  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 217, __pyx_L1_error)
6264  __Pyx_GOTREF(__pyx_t_17);
6265  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 217, __pyx_L1_error)
6266  __Pyx_GOTREF(__pyx_t_20);
6267  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 217, __pyx_L1_error)
6268  __Pyx_GOTREF(__pyx_t_19);
6269  __pyx_t_23 = PyTuple_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 217, __pyx_L1_error)
6270  __Pyx_GOTREF(__pyx_t_23);
6271  __Pyx_GIVEREF(__pyx_t_17);
6272  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_17);
6273  __Pyx_GIVEREF(__pyx_t_20);
6274  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_20);
6275  __Pyx_GIVEREF(__pyx_t_19);
6276  PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_19);
6277  __pyx_t_17 = 0;
6278  __pyx_t_20 = 0;
6279  __pyx_t_19 = 0;
6280  __pyx_t_19 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_23); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 217, __pyx_L1_error)
6281  __Pyx_GOTREF(__pyx_t_19);
6282  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6283  __pyx_t_23 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 217, __pyx_L1_error)
6284  __Pyx_GOTREF(__pyx_t_23);
6285  __pyx_t_20 = NULL;
6286  __pyx_t_22 = 0;
6287  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
6288  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_21);
6289  if (likely(__pyx_t_20)) {
6290  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
6291  __Pyx_INCREF(__pyx_t_20);
6292  __Pyx_INCREF(function);
6293  __Pyx_DECREF_SET(__pyx_t_21, function);
6294  __pyx_t_22 = 1;
6295  }
6296  }
6297  #if CYTHON_FAST_PYCALL
6298  if (PyFunction_Check(__pyx_t_21)) {
6299  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_23};
6300  __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 217, __pyx_L1_error)
6301  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
6302  __Pyx_GOTREF(__pyx_t_18);
6303  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6304  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6305  } else
6306  #endif
6307  #if CYTHON_FAST_PYCCALL
6308  if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
6309  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_23};
6310  __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 217, __pyx_L1_error)
6311  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
6312  __Pyx_GOTREF(__pyx_t_18);
6313  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6314  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6315  } else
6316  #endif
6317  {
6318  __pyx_t_17 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 217, __pyx_L1_error)
6319  __Pyx_GOTREF(__pyx_t_17);
6320  if (__pyx_t_20) {
6321  __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_20); __pyx_t_20 = NULL;
6322  }
6323  __Pyx_GIVEREF(__pyx_t_19);
6324  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_22, __pyx_t_19);
6325  __Pyx_GIVEREF(__pyx_t_23);
6326  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_22, __pyx_t_23);
6327  __pyx_t_19 = 0;
6328  __pyx_t_23 = 0;
6329  __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_17, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 217, __pyx_L1_error)
6330  __Pyx_GOTREF(__pyx_t_18);
6331  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6332  }
6333  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6334 
6335  /* "subsurfaceTransportFunctions.pyx":216
6336  * material_right= elementBoundaryTypes[ebN,1]
6337  * for k in range(x.shape[2]):
6338  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
6339  * material_functions[material_right](x[eN,ebN_local,k],t))
6340  *
6341  */
6342  __pyx_t_21 = PyNumber_Add(__pyx_t_16, __pyx_t_18); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 216, __pyx_L1_error)
6343  __Pyx_GOTREF(__pyx_t_21);
6344  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6345  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6346  __pyx_t_18 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_21); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 216, __pyx_L1_error)
6347  __Pyx_GOTREF(__pyx_t_18);
6348  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6349  __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_18); if (unlikely((__pyx_t_24 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L1_error)
6350  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6351  __pyx_t_25 = __pyx_v_eN;
6352  __pyx_t_26 = __pyx_v_ebN_local;
6353  __pyx_t_27 = __pyx_v_k;
6354  __pyx_t_22 = -1;
6355  if (__pyx_t_25 < 0) {
6356  __pyx_t_25 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
6357  if (unlikely(__pyx_t_25 < 0)) __pyx_t_22 = 0;
6358  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_22 = 0;
6359  if (__pyx_t_26 < 0) {
6360  __pyx_t_26 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
6361  if (unlikely(__pyx_t_26 < 0)) __pyx_t_22 = 1;
6362  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_22 = 1;
6363  if (__pyx_t_27 < 0) {
6364  __pyx_t_27 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
6365  if (unlikely(__pyx_t_27 < 0)) __pyx_t_22 = 2;
6366  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_22 = 2;
6367  if (unlikely(__pyx_t_22 != -1)) {
6368  __Pyx_RaiseBufferIndexError(__pyx_t_22);
6369  __PYX_ERR(0, 216, __pyx_L1_error)
6370  }
6371  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_27, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_24;
6372  }
6373  }
6374  }
6375 
6376  /* "subsurfaceTransportFunctions.pyx":195
6377  *
6378  *
6379  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
6380  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6381  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
6382  */
6383 
6384  /* function exit code */
6385  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6386  goto __pyx_L0;
6387  __pyx_L1_error:;
6388  __Pyx_XDECREF(__pyx_t_16);
6389  __Pyx_XDECREF(__pyx_t_17);
6390  __Pyx_XDECREF(__pyx_t_18);
6391  __Pyx_XDECREF(__pyx_t_19);
6392  __Pyx_XDECREF(__pyx_t_20);
6393  __Pyx_XDECREF(__pyx_t_21);
6394  __Pyx_XDECREF(__pyx_t_23);
6395  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6396  __Pyx_PyThreadState_declare
6397  __Pyx_PyThreadState_assign
6398  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6399  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6400  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6401  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6402  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6403  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6404  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6405  __pyx_r = NULL;
6406  goto __pyx_L2;
6407  __pyx_L0:;
6408  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6409  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6410  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6411  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6412  __pyx_L2:;
6413  __Pyx_XGIVEREF(__pyx_r);
6414  __Pyx_RefNannyFinishContext();
6415  return __pyx_r;
6416 }
6417 
6418 /* "subsurfaceTransportFunctions.pyx":219
6419  * material_functions[material_right](x[eN,ebN_local,k],t))
6420  *
6421  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
6422  * double t,
6423  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6424  */
6425 
6426 /* Python wrapper */
6427 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6428 static char __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
6429 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
6430 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6431  int __pyx_v_nd;
6432  double __pyx_v_t;
6433  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
6434  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
6435  PyArrayObject *__pyx_v_x = 0;
6436  PyArrayObject *__pyx_v_ebq_vals = 0;
6437  PyObject *__pyx_v_material_functions = 0;
6438  PyObject *__pyx_r = 0;
6439  __Pyx_RefNannyDeclarations
6440  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
6441  {
6442  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
6443  PyObject* values[7] = {0,0,0,0,0,0,0};
6444  if (unlikely(__pyx_kwds)) {
6445  Py_ssize_t kw_args;
6446  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6447  switch (pos_args) {
6448  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6449  CYTHON_FALLTHROUGH;
6450  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6451  CYTHON_FALLTHROUGH;
6452  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6453  CYTHON_FALLTHROUGH;
6454  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6455  CYTHON_FALLTHROUGH;
6456  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6457  CYTHON_FALLTHROUGH;
6458  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6459  CYTHON_FALLTHROUGH;
6460  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6461  CYTHON_FALLTHROUGH;
6462  case 0: break;
6463  default: goto __pyx_L5_argtuple_error;
6464  }
6465  kw_args = PyDict_Size(__pyx_kwds);
6466  switch (pos_args) {
6467  case 0:
6468  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
6469  else goto __pyx_L5_argtuple_error;
6470  CYTHON_FALLTHROUGH;
6471  case 1:
6472  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
6473  else {
6474  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 219, __pyx_L3_error)
6475  }
6476  CYTHON_FALLTHROUGH;
6477  case 2:
6478  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6479  else {
6480  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 219, __pyx_L3_error)
6481  }
6482  CYTHON_FALLTHROUGH;
6483  case 3:
6484  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
6485  else {
6486  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 219, __pyx_L3_error)
6487  }
6488  CYTHON_FALLTHROUGH;
6489  case 4:
6490  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
6491  else {
6492  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 219, __pyx_L3_error)
6493  }
6494  CYTHON_FALLTHROUGH;
6495  case 5:
6496  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
6497  else {
6498  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 219, __pyx_L3_error)
6499  }
6500  CYTHON_FALLTHROUGH;
6501  case 6:
6502  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
6503  else {
6504  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 219, __pyx_L3_error)
6505  }
6506  }
6507  if (unlikely(kw_args > 0)) {
6508  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
6509  }
6510  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
6511  goto __pyx_L5_argtuple_error;
6512  } else {
6513  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6514  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6515  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6516  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6517  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6518  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6519  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6520  }
6521  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error)
6522  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error)
6523  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
6524  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
6525  __pyx_v_x = ((PyArrayObject *)values[4]);
6526  __pyx_v_ebq_vals = ((PyArrayObject *)values[5]);
6527  __pyx_v_material_functions = ((PyObject*)values[6]);
6528  }
6529  goto __pyx_L4_argument_unpacking_done;
6530  __pyx_L5_argtuple_error:;
6531  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
6532  __pyx_L3_error:;
6533  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6534  __Pyx_RefNannyFinishContext();
6535  return NULL;
6536  __pyx_L4_argument_unpacking_done:;
6537  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 221, __pyx_L1_error)
6538  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 222, __pyx_L1_error)
6539  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 223, __pyx_L1_error)
6540  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 224, __pyx_L1_error)
6541  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 225, __pyx_L1_error)
6542  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
6543 
6544  /* function exit code */
6545  goto __pyx_L0;
6546  __pyx_L1_error:;
6547  __pyx_r = NULL;
6548  __pyx_L0:;
6549  __Pyx_RefNannyFinishContext();
6550  return __pyx_r;
6551 }
6552 
6553 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
6554  int __pyx_v_eN;
6555  int __pyx_v_ebN;
6556  int __pyx_v_ebN_local;
6557  int __pyx_v_k;
6558  int __pyx_v_material_left;
6559  int __pyx_v_material_right;
6560  int __pyx_v_I;
6561  int __pyx_v_J;
6562  double __pyx_v_numer;
6563  double __pyx_v_denom;
6564  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
6565  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
6566  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
6567  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
6568  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
6569  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
6570  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
6571  __Pyx_Buffer __pyx_pybuffer_x;
6572  PyObject *__pyx_r = NULL;
6573  __Pyx_RefNannyDeclarations
6574  npy_intp __pyx_t_1;
6575  npy_intp __pyx_t_2;
6576  int __pyx_t_3;
6577  npy_intp __pyx_t_4;
6578  npy_intp __pyx_t_5;
6579  int __pyx_t_6;
6580  Py_ssize_t __pyx_t_7;
6581  Py_ssize_t __pyx_t_8;
6582  int __pyx_t_9;
6583  Py_ssize_t __pyx_t_10;
6584  Py_ssize_t __pyx_t_11;
6585  Py_ssize_t __pyx_t_12;
6586  Py_ssize_t __pyx_t_13;
6587  npy_intp __pyx_t_14;
6588  npy_intp __pyx_t_15;
6589  int __pyx_t_16;
6590  int __pyx_t_17;
6591  int __pyx_t_18;
6592  int __pyx_t_19;
6593  int __pyx_t_20;
6594  int __pyx_t_21;
6595  PyObject *__pyx_t_22 = NULL;
6596  PyObject *__pyx_t_23 = NULL;
6597  PyObject *__pyx_t_24 = NULL;
6598  PyObject *__pyx_t_25 = NULL;
6599  PyObject *__pyx_t_26 = NULL;
6600  PyObject *__pyx_t_27 = NULL;
6601  int __pyx_t_28;
6602  PyObject *__pyx_t_29 = NULL;
6603  double __pyx_t_30;
6604  Py_ssize_t __pyx_t_31;
6605  Py_ssize_t __pyx_t_32;
6606  Py_ssize_t __pyx_t_33;
6607  Py_ssize_t __pyx_t_34;
6608  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
6609  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6610  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6611  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6612  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6613  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6614  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6615  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6616  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6617  __pyx_pybuffer_x.pybuffer.buf = NULL;
6618  __pyx_pybuffer_x.refcount = 0;
6619  __pyx_pybuffernd_x.data = NULL;
6620  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6621  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
6622  __pyx_pybuffer_ebq_vals.refcount = 0;
6623  __pyx_pybuffernd_ebq_vals.data = NULL;
6624  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
6625  {
6626  __Pyx_BufFmt_StackElem __pyx_stack[1];
6627  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6628  }
6629  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
6630  {
6631  __Pyx_BufFmt_StackElem __pyx_stack[1];
6632  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6633  }
6634  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
6635  {
6636  __Pyx_BufFmt_StackElem __pyx_stack[1];
6637  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6638  }
6639  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
6640  {
6641  __Pyx_BufFmt_StackElem __pyx_stack[1];
6642  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6643  }
6644  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
6645 
6646  /* "subsurfaceTransportFunctions.pyx":236
6647  * cdef double numer,denom
6648  *
6649  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
6650  * for ebN_local in range(x.shape[1]):
6651  * ebN = elementBoundariesArray[eN,ebN_local]
6652  */
6653  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
6654  __pyx_t_2 = __pyx_t_1;
6655  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6656  __pyx_v_eN = __pyx_t_3;
6657 
6658  /* "subsurfaceTransportFunctions.pyx":237
6659  *
6660  * for eN in range(x.shape[0]):
6661  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6662  * ebN = elementBoundariesArray[eN,ebN_local]
6663  * material_left = elementBoundaryTypes[ebN,0]
6664  */
6665  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
6666  __pyx_t_5 = __pyx_t_4;
6667  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6668  __pyx_v_ebN_local = __pyx_t_6;
6669 
6670  /* "subsurfaceTransportFunctions.pyx":238
6671  * for eN in range(x.shape[0]):
6672  * for ebN_local in range(x.shape[1]):
6673  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6674  * material_left = elementBoundaryTypes[ebN,0]
6675  * material_right= elementBoundaryTypes[ebN,1]
6676  */
6677  __pyx_t_7 = __pyx_v_eN;
6678  __pyx_t_8 = __pyx_v_ebN_local;
6679  __pyx_t_9 = -1;
6680  if (__pyx_t_7 < 0) {
6681  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6682  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6683  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
6684  if (__pyx_t_8 < 0) {
6685  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6686  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6687  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
6688  if (unlikely(__pyx_t_9 != -1)) {
6689  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6690  __PYX_ERR(0, 238, __pyx_L1_error)
6691  }
6692  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
6693 
6694  /* "subsurfaceTransportFunctions.pyx":239
6695  * for ebN_local in range(x.shape[1]):
6696  * ebN = elementBoundariesArray[eN,ebN_local]
6697  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6698  * material_right= elementBoundaryTypes[ebN,1]
6699  * for k in range(x.shape[2]):
6700  */
6701  __pyx_t_10 = __pyx_v_ebN;
6702  __pyx_t_11 = 0;
6703  __pyx_t_9 = -1;
6704  if (__pyx_t_10 < 0) {
6705  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6706  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
6707  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6708  if (__pyx_t_11 < 0) {
6709  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6710  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
6711  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6712  if (unlikely(__pyx_t_9 != -1)) {
6713  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6714  __PYX_ERR(0, 239, __pyx_L1_error)
6715  }
6716  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6717 
6718  /* "subsurfaceTransportFunctions.pyx":240
6719  * ebN = elementBoundariesArray[eN,ebN_local]
6720  * material_left = elementBoundaryTypes[ebN,0]
6721  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6722  * for k in range(x.shape[2]):
6723  * for I in range(nd):
6724  */
6725  __pyx_t_12 = __pyx_v_ebN;
6726  __pyx_t_13 = 1;
6727  __pyx_t_9 = -1;
6728  if (__pyx_t_12 < 0) {
6729  __pyx_t_12 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6730  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
6731  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6732  if (__pyx_t_13 < 0) {
6733  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6734  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
6735  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6736  if (unlikely(__pyx_t_9 != -1)) {
6737  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6738  __PYX_ERR(0, 240, __pyx_L1_error)
6739  }
6740  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6741 
6742  /* "subsurfaceTransportFunctions.pyx":241
6743  * material_left = elementBoundaryTypes[ebN,0]
6744  * material_right= elementBoundaryTypes[ebN,1]
6745  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6746  * for I in range(nd):
6747  * for J in range(nd):
6748  */
6749  __pyx_t_14 = (__pyx_v_x->dimensions[2]);
6750  __pyx_t_15 = __pyx_t_14;
6751  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_15; __pyx_t_9+=1) {
6752  __pyx_v_k = __pyx_t_9;
6753 
6754  /* "subsurfaceTransportFunctions.pyx":242
6755  * material_right= elementBoundaryTypes[ebN,1]
6756  * for k in range(x.shape[2]):
6757  * for I in range(nd): # <<<<<<<<<<<<<<
6758  * for J in range(nd):
6759  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6760  */
6761  __pyx_t_16 = __pyx_v_nd;
6762  __pyx_t_17 = __pyx_t_16;
6763  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
6764  __pyx_v_I = __pyx_t_18;
6765 
6766  /* "subsurfaceTransportFunctions.pyx":243
6767  * for k in range(x.shape[2]):
6768  * for I in range(nd):
6769  * for J in range(nd): # <<<<<<<<<<<<<<
6770  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6771  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6772  */
6773  __pyx_t_19 = __pyx_v_nd;
6774  __pyx_t_20 = __pyx_t_19;
6775  for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
6776  __pyx_v_J = __pyx_t_21;
6777 
6778  /* "subsurfaceTransportFunctions.pyx":244
6779  * for I in range(nd):
6780  * for J in range(nd):
6781  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J] # <<<<<<<<<<<<<<
6782  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6783  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6784  */
6785  if (unlikely(__pyx_v_material_functions == Py_None)) {
6786  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6787  __PYX_ERR(0, 244, __pyx_L1_error)
6788  }
6789  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6790  __Pyx_GOTREF(__pyx_t_23);
6791  __pyx_t_24 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_23); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
6792  __Pyx_GOTREF(__pyx_t_24);
6793  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6794  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6795  __Pyx_GOTREF(__pyx_t_23);
6796  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
6797  __Pyx_GOTREF(__pyx_t_25);
6798  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 244, __pyx_L1_error)
6799  __Pyx_GOTREF(__pyx_t_26);
6800  __pyx_t_27 = PyTuple_New(3); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 244, __pyx_L1_error)
6801  __Pyx_GOTREF(__pyx_t_27);
6802  __Pyx_GIVEREF(__pyx_t_23);
6803  PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_23);
6804  __Pyx_GIVEREF(__pyx_t_25);
6805  PyTuple_SET_ITEM(__pyx_t_27, 1, __pyx_t_25);
6806  __Pyx_GIVEREF(__pyx_t_26);
6807  PyTuple_SET_ITEM(__pyx_t_27, 2, __pyx_t_26);
6808  __pyx_t_23 = 0;
6809  __pyx_t_25 = 0;
6810  __pyx_t_26 = 0;
6811  __pyx_t_26 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_27); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 244, __pyx_L1_error)
6812  __Pyx_GOTREF(__pyx_t_26);
6813  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
6814  __pyx_t_27 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 244, __pyx_L1_error)
6815  __Pyx_GOTREF(__pyx_t_27);
6816  __pyx_t_25 = NULL;
6817  __pyx_t_28 = 0;
6818  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_24))) {
6819  __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_24);
6820  if (likely(__pyx_t_25)) {
6821  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24);
6822  __Pyx_INCREF(__pyx_t_25);
6823  __Pyx_INCREF(function);
6824  __Pyx_DECREF_SET(__pyx_t_24, function);
6825  __pyx_t_28 = 1;
6826  }
6827  }
6828  #if CYTHON_FAST_PYCALL
6829  if (PyFunction_Check(__pyx_t_24)) {
6830  PyObject *__pyx_temp[3] = {__pyx_t_25, __pyx_t_26, __pyx_t_27};
6831  __pyx_t_22 = __Pyx_PyFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6832  __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
6833  __Pyx_GOTREF(__pyx_t_22);
6834  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
6835  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
6836  } else
6837  #endif
6838  #if CYTHON_FAST_PYCCALL
6839  if (__Pyx_PyFastCFunction_Check(__pyx_t_24)) {
6840  PyObject *__pyx_temp[3] = {__pyx_t_25, __pyx_t_26, __pyx_t_27};
6841  __pyx_t_22 = __Pyx_PyCFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6842  __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
6843  __Pyx_GOTREF(__pyx_t_22);
6844  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
6845  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
6846  } else
6847  #endif
6848  {
6849  __pyx_t_23 = PyTuple_New(2+__pyx_t_28); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6850  __Pyx_GOTREF(__pyx_t_23);
6851  if (__pyx_t_25) {
6852  __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_25); __pyx_t_25 = NULL;
6853  }
6854  __Pyx_GIVEREF(__pyx_t_26);
6855  PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_28, __pyx_t_26);
6856  __Pyx_GIVEREF(__pyx_t_27);
6857  PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_28, __pyx_t_27);
6858  __pyx_t_26 = 0;
6859  __pyx_t_27 = 0;
6860  __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_23, NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6861  __Pyx_GOTREF(__pyx_t_22);
6862  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6863  }
6864  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6865  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
6866  __Pyx_GOTREF(__pyx_t_24);
6867  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6868  __Pyx_GOTREF(__pyx_t_23);
6869  __pyx_t_27 = PyTuple_New(2); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 244, __pyx_L1_error)
6870  __Pyx_GOTREF(__pyx_t_27);
6871  __Pyx_GIVEREF(__pyx_t_24);
6872  PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_24);
6873  __Pyx_GIVEREF(__pyx_t_23);
6874  PyTuple_SET_ITEM(__pyx_t_27, 1, __pyx_t_23);
6875  __pyx_t_24 = 0;
6876  __pyx_t_23 = 0;
6877  __pyx_t_23 = __Pyx_PyObject_GetItem(__pyx_t_22, __pyx_t_27); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6878  __Pyx_GOTREF(__pyx_t_23);
6879  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6880  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
6881  __pyx_t_27 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_23); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 244, __pyx_L1_error)
6882  __Pyx_GOTREF(__pyx_t_27);
6883  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6884  if (unlikely(__pyx_v_material_functions == Py_None)) {
6885  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6886  __PYX_ERR(0, 244, __pyx_L1_error)
6887  }
6888  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6889  __Pyx_GOTREF(__pyx_t_22);
6890  __pyx_t_24 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
6891  __Pyx_GOTREF(__pyx_t_24);
6892  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6893  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6894  __Pyx_GOTREF(__pyx_t_22);
6895  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 244, __pyx_L1_error)
6896  __Pyx_GOTREF(__pyx_t_26);
6897  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
6898  __Pyx_GOTREF(__pyx_t_25);
6899  __pyx_t_29 = PyTuple_New(3); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 244, __pyx_L1_error)
6900  __Pyx_GOTREF(__pyx_t_29);
6901  __Pyx_GIVEREF(__pyx_t_22);
6902  PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_t_22);
6903  __Pyx_GIVEREF(__pyx_t_26);
6904  PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_26);
6905  __Pyx_GIVEREF(__pyx_t_25);
6906  PyTuple_SET_ITEM(__pyx_t_29, 2, __pyx_t_25);
6907  __pyx_t_22 = 0;
6908  __pyx_t_26 = 0;
6909  __pyx_t_25 = 0;
6910  __pyx_t_25 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_29); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
6911  __Pyx_GOTREF(__pyx_t_25);
6912  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
6913  __pyx_t_29 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 244, __pyx_L1_error)
6914  __Pyx_GOTREF(__pyx_t_29);
6915  __pyx_t_26 = NULL;
6916  __pyx_t_28 = 0;
6917  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_24))) {
6918  __pyx_t_26 = PyMethod_GET_SELF(__pyx_t_24);
6919  if (likely(__pyx_t_26)) {
6920  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24);
6921  __Pyx_INCREF(__pyx_t_26);
6922  __Pyx_INCREF(function);
6923  __Pyx_DECREF_SET(__pyx_t_24, function);
6924  __pyx_t_28 = 1;
6925  }
6926  }
6927  #if CYTHON_FAST_PYCALL
6928  if (PyFunction_Check(__pyx_t_24)) {
6929  PyObject *__pyx_temp[3] = {__pyx_t_26, __pyx_t_25, __pyx_t_29};
6930  __pyx_t_23 = __Pyx_PyFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6931  __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
6932  __Pyx_GOTREF(__pyx_t_23);
6933  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
6934  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
6935  } else
6936  #endif
6937  #if CYTHON_FAST_PYCCALL
6938  if (__Pyx_PyFastCFunction_Check(__pyx_t_24)) {
6939  PyObject *__pyx_temp[3] = {__pyx_t_26, __pyx_t_25, __pyx_t_29};
6940  __pyx_t_23 = __Pyx_PyCFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6941  __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
6942  __Pyx_GOTREF(__pyx_t_23);
6943  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
6944  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
6945  } else
6946  #endif
6947  {
6948  __pyx_t_22 = PyTuple_New(2+__pyx_t_28); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6949  __Pyx_GOTREF(__pyx_t_22);
6950  if (__pyx_t_26) {
6951  __Pyx_GIVEREF(__pyx_t_26); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_26); __pyx_t_26 = NULL;
6952  }
6953  __Pyx_GIVEREF(__pyx_t_25);
6954  PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_28, __pyx_t_25);
6955  __Pyx_GIVEREF(__pyx_t_29);
6956  PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_28, __pyx_t_29);
6957  __pyx_t_25 = 0;
6958  __pyx_t_29 = 0;
6959  __pyx_t_23 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_22, NULL); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6960  __Pyx_GOTREF(__pyx_t_23);
6961  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6962  }
6963  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6964  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
6965  __Pyx_GOTREF(__pyx_t_24);
6966  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6967  __Pyx_GOTREF(__pyx_t_22);
6968  __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 244, __pyx_L1_error)
6969  __Pyx_GOTREF(__pyx_t_29);
6970  __Pyx_GIVEREF(__pyx_t_24);
6971  PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_t_24);
6972  __Pyx_GIVEREF(__pyx_t_22);
6973  PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_22);
6974  __pyx_t_24 = 0;
6975  __pyx_t_22 = 0;
6976  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_23, __pyx_t_29); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6977  __Pyx_GOTREF(__pyx_t_22);
6978  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6979  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
6980  __pyx_t_29 = PyNumber_Multiply(__pyx_t_27, __pyx_t_22); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 244, __pyx_L1_error)
6981  __Pyx_GOTREF(__pyx_t_29);
6982  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
6983  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6984  __pyx_t_30 = __pyx_PyFloat_AsDouble(__pyx_t_29); if (unlikely((__pyx_t_30 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error)
6985  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
6986  __pyx_v_numer = __pyx_t_30;
6987 
6988  /* "subsurfaceTransportFunctions.pyx":245
6989  * for J in range(nd):
6990  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6991  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
6992  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6993  *
6994  */
6995  if (unlikely(__pyx_v_material_functions == Py_None)) {
6996  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6997  __PYX_ERR(0, 245, __pyx_L1_error)
6998  }
6999  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7000  __Pyx_GOTREF(__pyx_t_22);
7001  __pyx_t_27 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 245, __pyx_L1_error)
7002  __Pyx_GOTREF(__pyx_t_27);
7003  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7004  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7005  __Pyx_GOTREF(__pyx_t_22);
7006  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7007  __Pyx_GOTREF(__pyx_t_23);
7008  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
7009  __Pyx_GOTREF(__pyx_t_24);
7010  __pyx_t_25 = PyTuple_New(3); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7011  __Pyx_GOTREF(__pyx_t_25);
7012  __Pyx_GIVEREF(__pyx_t_22);
7013  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_22);
7014  __Pyx_GIVEREF(__pyx_t_23);
7015  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_23);
7016  __Pyx_GIVEREF(__pyx_t_24);
7017  PyTuple_SET_ITEM(__pyx_t_25, 2, __pyx_t_24);
7018  __pyx_t_22 = 0;
7019  __pyx_t_23 = 0;
7020  __pyx_t_24 = 0;
7021  __pyx_t_24 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_25); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
7022  __Pyx_GOTREF(__pyx_t_24);
7023  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7024  __pyx_t_25 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7025  __Pyx_GOTREF(__pyx_t_25);
7026  __pyx_t_23 = NULL;
7027  __pyx_t_28 = 0;
7028  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_27))) {
7029  __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_27);
7030  if (likely(__pyx_t_23)) {
7031  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_27);
7032  __Pyx_INCREF(__pyx_t_23);
7033  __Pyx_INCREF(function);
7034  __Pyx_DECREF_SET(__pyx_t_27, function);
7035  __pyx_t_28 = 1;
7036  }
7037  }
7038  #if CYTHON_FAST_PYCALL
7039  if (PyFunction_Check(__pyx_t_27)) {
7040  PyObject *__pyx_temp[3] = {__pyx_t_23, __pyx_t_24, __pyx_t_25};
7041  __pyx_t_29 = __Pyx_PyFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7042  __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
7043  __Pyx_GOTREF(__pyx_t_29);
7044  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
7045  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7046  } else
7047  #endif
7048  #if CYTHON_FAST_PYCCALL
7049  if (__Pyx_PyFastCFunction_Check(__pyx_t_27)) {
7050  PyObject *__pyx_temp[3] = {__pyx_t_23, __pyx_t_24, __pyx_t_25};
7051  __pyx_t_29 = __Pyx_PyCFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7052  __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
7053  __Pyx_GOTREF(__pyx_t_29);
7054  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
7055  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7056  } else
7057  #endif
7058  {
7059  __pyx_t_22 = PyTuple_New(2+__pyx_t_28); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7060  __Pyx_GOTREF(__pyx_t_22);
7061  if (__pyx_t_23) {
7062  __Pyx_GIVEREF(__pyx_t_23); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_23); __pyx_t_23 = NULL;
7063  }
7064  __Pyx_GIVEREF(__pyx_t_24);
7065  PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_28, __pyx_t_24);
7066  __Pyx_GIVEREF(__pyx_t_25);
7067  PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_28, __pyx_t_25);
7068  __pyx_t_24 = 0;
7069  __pyx_t_25 = 0;
7070  __pyx_t_29 = __Pyx_PyObject_Call(__pyx_t_27, __pyx_t_22, NULL); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7071  __Pyx_GOTREF(__pyx_t_29);
7072  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7073  }
7074  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
7075  __pyx_t_27 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 245, __pyx_L1_error)
7076  __Pyx_GOTREF(__pyx_t_27);
7077  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7078  __Pyx_GOTREF(__pyx_t_22);
7079  __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7080  __Pyx_GOTREF(__pyx_t_25);
7081  __Pyx_GIVEREF(__pyx_t_27);
7082  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_27);
7083  __Pyx_GIVEREF(__pyx_t_22);
7084  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_22);
7085  __pyx_t_27 = 0;
7086  __pyx_t_22 = 0;
7087  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_29, __pyx_t_25); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7088  __Pyx_GOTREF(__pyx_t_22);
7089  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7090  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7091  if (unlikely(__pyx_v_material_functions == Py_None)) {
7092  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7093  __PYX_ERR(0, 245, __pyx_L1_error)
7094  }
7095  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7096  __Pyx_GOTREF(__pyx_t_29);
7097  __pyx_t_27 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_29); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 245, __pyx_L1_error)
7098  __Pyx_GOTREF(__pyx_t_27);
7099  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7100  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7101  __Pyx_GOTREF(__pyx_t_29);
7102  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
7103  __Pyx_GOTREF(__pyx_t_24);
7104  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7105  __Pyx_GOTREF(__pyx_t_23);
7106  __pyx_t_26 = PyTuple_New(3); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 245, __pyx_L1_error)
7107  __Pyx_GOTREF(__pyx_t_26);
7108  __Pyx_GIVEREF(__pyx_t_29);
7109  PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_29);
7110  __Pyx_GIVEREF(__pyx_t_24);
7111  PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_24);
7112  __Pyx_GIVEREF(__pyx_t_23);
7113  PyTuple_SET_ITEM(__pyx_t_26, 2, __pyx_t_23);
7114  __pyx_t_29 = 0;
7115  __pyx_t_24 = 0;
7116  __pyx_t_23 = 0;
7117  __pyx_t_23 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_26); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7118  __Pyx_GOTREF(__pyx_t_23);
7119  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
7120  __pyx_t_26 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 245, __pyx_L1_error)
7121  __Pyx_GOTREF(__pyx_t_26);
7122  __pyx_t_24 = NULL;
7123  __pyx_t_28 = 0;
7124  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_27))) {
7125  __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_27);
7126  if (likely(__pyx_t_24)) {
7127  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_27);
7128  __Pyx_INCREF(__pyx_t_24);
7129  __Pyx_INCREF(function);
7130  __Pyx_DECREF_SET(__pyx_t_27, function);
7131  __pyx_t_28 = 1;
7132  }
7133  }
7134  #if CYTHON_FAST_PYCALL
7135  if (PyFunction_Check(__pyx_t_27)) {
7136  PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_23, __pyx_t_26};
7137  __pyx_t_25 = __Pyx_PyFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7138  __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
7139  __Pyx_GOTREF(__pyx_t_25);
7140  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7141  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
7142  } else
7143  #endif
7144  #if CYTHON_FAST_PYCCALL
7145  if (__Pyx_PyFastCFunction_Check(__pyx_t_27)) {
7146  PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_23, __pyx_t_26};
7147  __pyx_t_25 = __Pyx_PyCFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_28, 2+__pyx_t_28); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7148  __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
7149  __Pyx_GOTREF(__pyx_t_25);
7150  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7151  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
7152  } else
7153  #endif
7154  {
7155  __pyx_t_29 = PyTuple_New(2+__pyx_t_28); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7156  __Pyx_GOTREF(__pyx_t_29);
7157  if (__pyx_t_24) {
7158  __Pyx_GIVEREF(__pyx_t_24); PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_t_24); __pyx_t_24 = NULL;
7159  }
7160  __Pyx_GIVEREF(__pyx_t_23);
7161  PyTuple_SET_ITEM(__pyx_t_29, 0+__pyx_t_28, __pyx_t_23);
7162  __Pyx_GIVEREF(__pyx_t_26);
7163  PyTuple_SET_ITEM(__pyx_t_29, 1+__pyx_t_28, __pyx_t_26);
7164  __pyx_t_23 = 0;
7165  __pyx_t_26 = 0;
7166  __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_27, __pyx_t_29, NULL); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7167  __Pyx_GOTREF(__pyx_t_25);
7168  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7169  }
7170  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
7171  __pyx_t_27 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 245, __pyx_L1_error)
7172  __Pyx_GOTREF(__pyx_t_27);
7173  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7174  __Pyx_GOTREF(__pyx_t_29);
7175  __pyx_t_26 = PyTuple_New(2); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 245, __pyx_L1_error)
7176  __Pyx_GOTREF(__pyx_t_26);
7177  __Pyx_GIVEREF(__pyx_t_27);
7178  PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_27);
7179  __Pyx_GIVEREF(__pyx_t_29);
7180  PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_29);
7181  __pyx_t_27 = 0;
7182  __pyx_t_29 = 0;
7183  __pyx_t_29 = __Pyx_PyObject_GetItem(__pyx_t_25, __pyx_t_26); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7184  __Pyx_GOTREF(__pyx_t_29);
7185  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7186  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
7187  __pyx_t_26 = PyNumber_Add(__pyx_t_22, __pyx_t_29); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 245, __pyx_L1_error)
7188  __Pyx_GOTREF(__pyx_t_26);
7189  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7190  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7191  __pyx_t_29 = __Pyx_PyFloat_AddObjC(__pyx_t_26, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 245, __pyx_L1_error)
7192  __Pyx_GOTREF(__pyx_t_29);
7193  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
7194  __pyx_t_30 = __pyx_PyFloat_AsDouble(__pyx_t_29); if (unlikely((__pyx_t_30 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error)
7195  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
7196  __pyx_v_denom = __pyx_t_30;
7197 
7198  /* "subsurfaceTransportFunctions.pyx":246
7199  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
7200  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
7201  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
7202  *
7203  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t,
7204  */
7205  if (unlikely(__pyx_v_denom == 0)) {
7206  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
7207  __PYX_ERR(0, 246, __pyx_L1_error)
7208  }
7209  __pyx_t_31 = __pyx_v_eN;
7210  __pyx_t_32 = __pyx_v_ebN_local;
7211  __pyx_t_33 = __pyx_v_k;
7212  __pyx_t_34 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
7213  __pyx_t_28 = -1;
7214  if (__pyx_t_31 < 0) {
7215  __pyx_t_31 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
7216  if (unlikely(__pyx_t_31 < 0)) __pyx_t_28 = 0;
7217  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_28 = 0;
7218  if (__pyx_t_32 < 0) {
7219  __pyx_t_32 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
7220  if (unlikely(__pyx_t_32 < 0)) __pyx_t_28 = 1;
7221  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_28 = 1;
7222  if (__pyx_t_33 < 0) {
7223  __pyx_t_33 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
7224  if (unlikely(__pyx_t_33 < 0)) __pyx_t_28 = 2;
7225  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_28 = 2;
7226  if (__pyx_t_34 < 0) {
7227  __pyx_t_34 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
7228  if (unlikely(__pyx_t_34 < 0)) __pyx_t_28 = 3;
7229  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_28 = 3;
7230  if (unlikely(__pyx_t_28 != -1)) {
7231  __Pyx_RaiseBufferIndexError(__pyx_t_28);
7232  __PYX_ERR(0, 246, __pyx_L1_error)
7233  }
7234  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_34, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
7235  }
7236  }
7237  }
7238  }
7239  }
7240 
7241  /* "subsurfaceTransportFunctions.pyx":219
7242  * material_functions[material_right](x[eN,ebN_local,k],t))
7243  *
7244  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
7245  * double t,
7246  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7247  */
7248 
7249  /* function exit code */
7250  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7251  goto __pyx_L0;
7252  __pyx_L1_error:;
7253  __Pyx_XDECREF(__pyx_t_22);
7254  __Pyx_XDECREF(__pyx_t_23);
7255  __Pyx_XDECREF(__pyx_t_24);
7256  __Pyx_XDECREF(__pyx_t_25);
7257  __Pyx_XDECREF(__pyx_t_26);
7258  __Pyx_XDECREF(__pyx_t_27);
7259  __Pyx_XDECREF(__pyx_t_29);
7260  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7261  __Pyx_PyThreadState_declare
7262  __Pyx_PyThreadState_assign
7263  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7264  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
7265  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7266  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7267  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7268  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7269  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7270  __pyx_r = NULL;
7271  goto __pyx_L2;
7272  __pyx_L0:;
7273  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
7274  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7275  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7276  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7277  __pyx_L2:;
7278  __Pyx_XGIVEREF(__pyx_r);
7279  __Pyx_RefNannyFinishContext();
7280  return __pyx_r;
7281 }
7282 
7283 /* "subsurfaceTransportFunctions.pyx":248
7284  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7285  *
7286  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
7287  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7288  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
7289  */
7290 
7291 /* Python wrapper */
7292 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7293 static char __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
7294 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
7295 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7296  double __pyx_v_t;
7297  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
7298  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
7299  PyArrayObject *__pyx_v_x = 0;
7300  PyArrayObject *__pyx_v_ebq_global_vals = 0;
7301  PyObject *__pyx_v_material_functions = 0;
7302  PyObject *__pyx_r = 0;
7303  __Pyx_RefNannyDeclarations
7304  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
7305  {
7306  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
7307  PyObject* values[6] = {0,0,0,0,0,0};
7308  if (unlikely(__pyx_kwds)) {
7309  Py_ssize_t kw_args;
7310  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7311  switch (pos_args) {
7312  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7313  CYTHON_FALLTHROUGH;
7314  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7315  CYTHON_FALLTHROUGH;
7316  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7317  CYTHON_FALLTHROUGH;
7318  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7319  CYTHON_FALLTHROUGH;
7320  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7321  CYTHON_FALLTHROUGH;
7322  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7323  CYTHON_FALLTHROUGH;
7324  case 0: break;
7325  default: goto __pyx_L5_argtuple_error;
7326  }
7327  kw_args = PyDict_Size(__pyx_kwds);
7328  switch (pos_args) {
7329  case 0:
7330  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
7331  else goto __pyx_L5_argtuple_error;
7332  CYTHON_FALLTHROUGH;
7333  case 1:
7334  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7335  else {
7336  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 248, __pyx_L3_error)
7337  }
7338  CYTHON_FALLTHROUGH;
7339  case 2:
7340  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
7341  else {
7342  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 248, __pyx_L3_error)
7343  }
7344  CYTHON_FALLTHROUGH;
7345  case 3:
7346  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7347  else {
7348  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 248, __pyx_L3_error)
7349  }
7350  CYTHON_FALLTHROUGH;
7351  case 4:
7352  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
7353  else {
7354  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 248, __pyx_L3_error)
7355  }
7356  CYTHON_FALLTHROUGH;
7357  case 5:
7358  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
7359  else {
7360  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 248, __pyx_L3_error)
7361  }
7362  }
7363  if (unlikely(kw_args > 0)) {
7364  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 248, __pyx_L3_error)
7365  }
7366  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
7367  goto __pyx_L5_argtuple_error;
7368  } else {
7369  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7370  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7371  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7372  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7373  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7374  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7375  }
7376  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L3_error)
7377  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
7378  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
7379  __pyx_v_x = ((PyArrayObject *)values[3]);
7380  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[4]);
7381  __pyx_v_material_functions = ((PyObject*)values[5]);
7382  }
7383  goto __pyx_L4_argument_unpacking_done;
7384  __pyx_L5_argtuple_error:;
7385  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 248, __pyx_L3_error)
7386  __pyx_L3_error:;
7387  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7388  __Pyx_RefNannyFinishContext();
7389  return NULL;
7390  __pyx_L4_argument_unpacking_done:;
7391  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 249, __pyx_L1_error)
7392  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 250, __pyx_L1_error)
7393  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 251, __pyx_L1_error)
7394  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 252, __pyx_L1_error)
7395  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 253, __pyx_L1_error)
7396  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
7397 
7398  /* function exit code */
7399  goto __pyx_L0;
7400  __pyx_L1_error:;
7401  __pyx_r = NULL;
7402  __pyx_L0:;
7403  __Pyx_RefNannyFinishContext();
7404  return __pyx_r;
7405 }
7406 
7407 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
7408  int __pyx_v_ebN;
7409  int __pyx_v_material_left;
7410  int __pyx_v_material_right;
7411  npy_intp __pyx_v_k;
7412  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
7413  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
7414  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
7415  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
7416  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
7417  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
7418  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
7419  __Pyx_Buffer __pyx_pybuffer_x;
7420  PyObject *__pyx_r = NULL;
7421  __Pyx_RefNannyDeclarations
7422  npy_intp __pyx_t_1;
7423  npy_intp __pyx_t_2;
7424  int __pyx_t_3;
7425  Py_ssize_t __pyx_t_4;
7426  Py_ssize_t __pyx_t_5;
7427  int __pyx_t_6;
7428  Py_ssize_t __pyx_t_7;
7429  Py_ssize_t __pyx_t_8;
7430  npy_intp __pyx_t_9;
7431  npy_intp __pyx_t_10;
7432  npy_intp __pyx_t_11;
7433  PyObject *__pyx_t_12 = NULL;
7434  PyObject *__pyx_t_13 = NULL;
7435  PyObject *__pyx_t_14 = NULL;
7436  PyObject *__pyx_t_15 = NULL;
7437  PyObject *__pyx_t_16 = NULL;
7438  PyObject *__pyx_t_17 = NULL;
7439  PyObject *__pyx_t_18 = NULL;
7440  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_19;
7441  Py_ssize_t __pyx_t_20;
7442  Py_ssize_t __pyx_t_21;
7443  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
7444  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
7445  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
7446  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
7447  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
7448  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
7449  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
7450  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
7451  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
7452  __pyx_pybuffer_x.pybuffer.buf = NULL;
7453  __pyx_pybuffer_x.refcount = 0;
7454  __pyx_pybuffernd_x.data = NULL;
7455  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
7456  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
7457  __pyx_pybuffer_ebq_global_vals.refcount = 0;
7458  __pyx_pybuffernd_ebq_global_vals.data = NULL;
7459  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
7460  {
7461  __Pyx_BufFmt_StackElem __pyx_stack[1];
7462  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7463  }
7464  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
7465  {
7466  __Pyx_BufFmt_StackElem __pyx_stack[1];
7467  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7468  }
7469  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
7470  {
7471  __Pyx_BufFmt_StackElem __pyx_stack[1];
7472  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7473  }
7474  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
7475  {
7476  __Pyx_BufFmt_StackElem __pyx_stack[1];
7477  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7478  }
7479  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
7480 
7481  /* "subsurfaceTransportFunctions.pyx":263
7482  * cdef int ebN,material_left,material_right
7483  *
7484  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
7485  * material_left = elementBoundaryTypes[ebN,0]
7486  * material_right= elementBoundaryTypes[ebN,1]
7487  */
7488  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
7489  __pyx_t_2 = __pyx_t_1;
7490  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
7491  __pyx_v_ebN = __pyx_t_3;
7492 
7493  /* "subsurfaceTransportFunctions.pyx":264
7494  *
7495  * for ebN in range(x.shape[0]):
7496  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
7497  * material_right= elementBoundaryTypes[ebN,1]
7498  * for k in range(x.shape[1]):
7499  */
7500  __pyx_t_4 = __pyx_v_ebN;
7501  __pyx_t_5 = 0;
7502  __pyx_t_6 = -1;
7503  if (__pyx_t_4 < 0) {
7504  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7505  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
7506  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
7507  if (__pyx_t_5 < 0) {
7508  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7509  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
7510  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
7511  if (unlikely(__pyx_t_6 != -1)) {
7512  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7513  __PYX_ERR(0, 264, __pyx_L1_error)
7514  }
7515  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7516 
7517  /* "subsurfaceTransportFunctions.pyx":265
7518  * for ebN in range(x.shape[0]):
7519  * material_left = elementBoundaryTypes[ebN,0]
7520  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
7521  * for k in range(x.shape[1]):
7522  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7523  */
7524  __pyx_t_7 = __pyx_v_ebN;
7525  __pyx_t_8 = 1;
7526  __pyx_t_6 = -1;
7527  if (__pyx_t_7 < 0) {
7528  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7529  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
7530  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
7531  if (__pyx_t_8 < 0) {
7532  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7533  if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 1;
7534  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
7535  if (unlikely(__pyx_t_6 != -1)) {
7536  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7537  __PYX_ERR(0, 265, __pyx_L1_error)
7538  }
7539  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7540 
7541  /* "subsurfaceTransportFunctions.pyx":266
7542  * material_left = elementBoundaryTypes[ebN,0]
7543  * material_right= elementBoundaryTypes[ebN,1]
7544  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
7545  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7546  * material_functions[material_right](x[ebN,k],t))
7547  */
7548  __pyx_t_9 = (__pyx_v_x->dimensions[1]);
7549  __pyx_t_10 = __pyx_t_9;
7550  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
7551  __pyx_v_k = __pyx_t_11;
7552 
7553  /* "subsurfaceTransportFunctions.pyx":267
7554  * material_right= elementBoundaryTypes[ebN,1]
7555  * for k in range(x.shape[1]):
7556  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7557  * material_functions[material_right](x[ebN,k],t))
7558  *
7559  */
7560  if (unlikely(__pyx_v_material_functions == Py_None)) {
7561  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7562  __PYX_ERR(0, 267, __pyx_L1_error)
7563  }
7564  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7565  __Pyx_GOTREF(__pyx_t_13);
7566  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7567  __Pyx_GOTREF(__pyx_t_14);
7568  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7569  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7570  __Pyx_GOTREF(__pyx_t_13);
7571  __pyx_t_15 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 267, __pyx_L1_error)
7572  __Pyx_GOTREF(__pyx_t_15);
7573  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 267, __pyx_L1_error)
7574  __Pyx_GOTREF(__pyx_t_16);
7575  __Pyx_GIVEREF(__pyx_t_13);
7576  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_13);
7577  __Pyx_GIVEREF(__pyx_t_15);
7578  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15);
7579  __pyx_t_13 = 0;
7580  __pyx_t_15 = 0;
7581  __pyx_t_15 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 267, __pyx_L1_error)
7582  __Pyx_GOTREF(__pyx_t_15);
7583  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7584  __pyx_t_16 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 267, __pyx_L1_error)
7585  __Pyx_GOTREF(__pyx_t_16);
7586  __pyx_t_13 = NULL;
7587  __pyx_t_6 = 0;
7588  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
7589  __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
7590  if (likely(__pyx_t_13)) {
7591  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
7592  __Pyx_INCREF(__pyx_t_13);
7593  __Pyx_INCREF(function);
7594  __Pyx_DECREF_SET(__pyx_t_14, function);
7595  __pyx_t_6 = 1;
7596  }
7597  }
7598  #if CYTHON_FAST_PYCALL
7599  if (PyFunction_Check(__pyx_t_14)) {
7600  PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_15, __pyx_t_16};
7601  __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7602  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
7603  __Pyx_GOTREF(__pyx_t_12);
7604  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7605  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7606  } else
7607  #endif
7608  #if CYTHON_FAST_PYCCALL
7609  if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
7610  PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_15, __pyx_t_16};
7611  __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7612  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
7613  __Pyx_GOTREF(__pyx_t_12);
7614  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7615  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7616  } else
7617  #endif
7618  {
7619  __pyx_t_17 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 267, __pyx_L1_error)
7620  __Pyx_GOTREF(__pyx_t_17);
7621  if (__pyx_t_13) {
7622  __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_13); __pyx_t_13 = NULL;
7623  }
7624  __Pyx_GIVEREF(__pyx_t_15);
7625  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_6, __pyx_t_15);
7626  __Pyx_GIVEREF(__pyx_t_16);
7627  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_6, __pyx_t_16);
7628  __pyx_t_15 = 0;
7629  __pyx_t_16 = 0;
7630  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_17, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7631  __Pyx_GOTREF(__pyx_t_12);
7632  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7633  }
7634  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7635 
7636  /* "subsurfaceTransportFunctions.pyx":268
7637  * for k in range(x.shape[1]):
7638  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7639  * material_functions[material_right](x[ebN,k],t)) # <<<<<<<<<<<<<<
7640  *
7641  *
7642  */
7643  if (unlikely(__pyx_v_material_functions == Py_None)) {
7644  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7645  __PYX_ERR(0, 268, __pyx_L1_error)
7646  }
7647  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 268, __pyx_L1_error)
7648  __Pyx_GOTREF(__pyx_t_17);
7649  __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 268, __pyx_L1_error)
7650  __Pyx_GOTREF(__pyx_t_16);
7651  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7652  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 268, __pyx_L1_error)
7653  __Pyx_GOTREF(__pyx_t_17);
7654  __pyx_t_15 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7655  __Pyx_GOTREF(__pyx_t_15);
7656  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7657  __Pyx_GOTREF(__pyx_t_13);
7658  __Pyx_GIVEREF(__pyx_t_17);
7659  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_17);
7660  __Pyx_GIVEREF(__pyx_t_15);
7661  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_15);
7662  __pyx_t_17 = 0;
7663  __pyx_t_15 = 0;
7664  __pyx_t_15 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_13); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7665  __Pyx_GOTREF(__pyx_t_15);
7666  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7667  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7668  __Pyx_GOTREF(__pyx_t_13);
7669  __pyx_t_17 = NULL;
7670  __pyx_t_6 = 0;
7671  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
7672  __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_16);
7673  if (likely(__pyx_t_17)) {
7674  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
7675  __Pyx_INCREF(__pyx_t_17);
7676  __Pyx_INCREF(function);
7677  __Pyx_DECREF_SET(__pyx_t_16, function);
7678  __pyx_t_6 = 1;
7679  }
7680  }
7681  #if CYTHON_FAST_PYCALL
7682  if (PyFunction_Check(__pyx_t_16)) {
7683  PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_15, __pyx_t_13};
7684  __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 268, __pyx_L1_error)
7685  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
7686  __Pyx_GOTREF(__pyx_t_14);
7687  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7688  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7689  } else
7690  #endif
7691  #if CYTHON_FAST_PYCCALL
7692  if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
7693  PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_15, __pyx_t_13};
7694  __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 268, __pyx_L1_error)
7695  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
7696  __Pyx_GOTREF(__pyx_t_14);
7697  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7698  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7699  } else
7700  #endif
7701  {
7702  __pyx_t_18 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 268, __pyx_L1_error)
7703  __Pyx_GOTREF(__pyx_t_18);
7704  if (__pyx_t_17) {
7705  __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17); __pyx_t_17 = NULL;
7706  }
7707  __Pyx_GIVEREF(__pyx_t_15);
7708  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_6, __pyx_t_15);
7709  __Pyx_GIVEREF(__pyx_t_13);
7710  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_6, __pyx_t_13);
7711  __pyx_t_15 = 0;
7712  __pyx_t_13 = 0;
7713  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_18, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 268, __pyx_L1_error)
7714  __Pyx_GOTREF(__pyx_t_14);
7715  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7716  }
7717  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7718 
7719  /* "subsurfaceTransportFunctions.pyx":267
7720  * material_right= elementBoundaryTypes[ebN,1]
7721  * for k in range(x.shape[1]):
7722  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7723  * material_functions[material_right](x[ebN,k],t))
7724  *
7725  */
7726  __pyx_t_16 = PyNumber_Add(__pyx_t_12, __pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 267, __pyx_L1_error)
7727  __Pyx_GOTREF(__pyx_t_16);
7728  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7729  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7730  __pyx_t_14 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_16); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7731  __Pyx_GOTREF(__pyx_t_14);
7732  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7733  __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_19 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L1_error)
7734  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7735  __pyx_t_20 = __pyx_v_ebN;
7736  __pyx_t_21 = __pyx_v_k;
7737  __pyx_t_6 = -1;
7738  if (__pyx_t_20 < 0) {
7739  __pyx_t_20 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
7740  if (unlikely(__pyx_t_20 < 0)) __pyx_t_6 = 0;
7741  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_6 = 0;
7742  if (__pyx_t_21 < 0) {
7743  __pyx_t_21 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
7744  if (unlikely(__pyx_t_21 < 0)) __pyx_t_6 = 1;
7745  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_6 = 1;
7746  if (unlikely(__pyx_t_6 != -1)) {
7747  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7748  __PYX_ERR(0, 267, __pyx_L1_error)
7749  }
7750  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_19;
7751  }
7752  }
7753 
7754  /* "subsurfaceTransportFunctions.pyx":248
7755  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7756  *
7757  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
7758  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7759  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
7760  */
7761 
7762  /* function exit code */
7763  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7764  goto __pyx_L0;
7765  __pyx_L1_error:;
7766  __Pyx_XDECREF(__pyx_t_12);
7767  __Pyx_XDECREF(__pyx_t_13);
7768  __Pyx_XDECREF(__pyx_t_14);
7769  __Pyx_XDECREF(__pyx_t_15);
7770  __Pyx_XDECREF(__pyx_t_16);
7771  __Pyx_XDECREF(__pyx_t_17);
7772  __Pyx_XDECREF(__pyx_t_18);
7773  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7774  __Pyx_PyThreadState_declare
7775  __Pyx_PyThreadState_assign
7776  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7777  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7778  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7779  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7780  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7781  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7782  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7783  __pyx_r = NULL;
7784  goto __pyx_L2;
7785  __pyx_L0:;
7786  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7787  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7788  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7789  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7790  __pyx_L2:;
7791  __Pyx_XGIVEREF(__pyx_r);
7792  __Pyx_RefNannyFinishContext();
7793  return __pyx_r;
7794 }
7795 
7796 /* "subsurfaceTransportFunctions.pyx":271
7797  *
7798  *
7799  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
7800  * double t,
7801  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7802  */
7803 
7804 /* Python wrapper */
7805 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7806 static char __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
7807 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
7808 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7809  int __pyx_v_nd;
7810  double __pyx_v_t;
7811  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
7812  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
7813  PyArrayObject *__pyx_v_x = 0;
7814  PyArrayObject *__pyx_v_ebq_global_vals = 0;
7815  PyObject *__pyx_v_material_functions = 0;
7816  PyObject *__pyx_r = 0;
7817  __Pyx_RefNannyDeclarations
7818  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
7819  {
7820  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
7821  PyObject* values[7] = {0,0,0,0,0,0,0};
7822  if (unlikely(__pyx_kwds)) {
7823  Py_ssize_t kw_args;
7824  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7825  switch (pos_args) {
7826  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7827  CYTHON_FALLTHROUGH;
7828  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7829  CYTHON_FALLTHROUGH;
7830  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7831  CYTHON_FALLTHROUGH;
7832  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7833  CYTHON_FALLTHROUGH;
7834  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7835  CYTHON_FALLTHROUGH;
7836  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7837  CYTHON_FALLTHROUGH;
7838  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7839  CYTHON_FALLTHROUGH;
7840  case 0: break;
7841  default: goto __pyx_L5_argtuple_error;
7842  }
7843  kw_args = PyDict_Size(__pyx_kwds);
7844  switch (pos_args) {
7845  case 0:
7846  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
7847  else goto __pyx_L5_argtuple_error;
7848  CYTHON_FALLTHROUGH;
7849  case 1:
7850  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
7851  else {
7852  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 271, __pyx_L3_error)
7853  }
7854  CYTHON_FALLTHROUGH;
7855  case 2:
7856  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7857  else {
7858  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 271, __pyx_L3_error)
7859  }
7860  CYTHON_FALLTHROUGH;
7861  case 3:
7862  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
7863  else {
7864  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 271, __pyx_L3_error)
7865  }
7866  CYTHON_FALLTHROUGH;
7867  case 4:
7868  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7869  else {
7870  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 271, __pyx_L3_error)
7871  }
7872  CYTHON_FALLTHROUGH;
7873  case 5:
7874  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
7875  else {
7876  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 271, __pyx_L3_error)
7877  }
7878  CYTHON_FALLTHROUGH;
7879  case 6:
7880  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
7881  else {
7882  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 271, __pyx_L3_error)
7883  }
7884  }
7885  if (unlikely(kw_args > 0)) {
7886  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 271, __pyx_L3_error)
7887  }
7888  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
7889  goto __pyx_L5_argtuple_error;
7890  } else {
7891  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7892  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7893  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7894  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7895  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7896  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7897  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7898  }
7899  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L3_error)
7900  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L3_error)
7901  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
7902  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
7903  __pyx_v_x = ((PyArrayObject *)values[4]);
7904  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[5]);
7905  __pyx_v_material_functions = ((PyObject*)values[6]);
7906  }
7907  goto __pyx_L4_argument_unpacking_done;
7908  __pyx_L5_argtuple_error:;
7909  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error)
7910  __pyx_L3_error:;
7911  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7912  __Pyx_RefNannyFinishContext();
7913  return NULL;
7914  __pyx_L4_argument_unpacking_done:;
7915  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 273, __pyx_L1_error)
7916  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 274, __pyx_L1_error)
7917  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 275, __pyx_L1_error)
7918  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 276, __pyx_L1_error)
7919  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 277, __pyx_L1_error)
7920  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
7921 
7922  /* function exit code */
7923  goto __pyx_L0;
7924  __pyx_L1_error:;
7925  __pyx_r = NULL;
7926  __pyx_L0:;
7927  __Pyx_RefNannyFinishContext();
7928  return __pyx_r;
7929 }
7930 
7931 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
7932  int __pyx_v_ebN;
7933  int __pyx_v_k;
7934  int __pyx_v_material_left;
7935  int __pyx_v_material_right;
7936  int __pyx_v_I;
7937  int __pyx_v_J;
7938  double __pyx_v_numer;
7939  double __pyx_v_denom;
7940  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
7941  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
7942  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
7943  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
7944  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
7945  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
7946  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
7947  __Pyx_Buffer __pyx_pybuffer_x;
7948  PyObject *__pyx_r = NULL;
7949  __Pyx_RefNannyDeclarations
7950  npy_intp __pyx_t_1;
7951  npy_intp __pyx_t_2;
7952  int __pyx_t_3;
7953  Py_ssize_t __pyx_t_4;
7954  Py_ssize_t __pyx_t_5;
7955  int __pyx_t_6;
7956  Py_ssize_t __pyx_t_7;
7957  Py_ssize_t __pyx_t_8;
7958  npy_intp __pyx_t_9;
7959  npy_intp __pyx_t_10;
7960  int __pyx_t_11;
7961  int __pyx_t_12;
7962  int __pyx_t_13;
7963  int __pyx_t_14;
7964  int __pyx_t_15;
7965  int __pyx_t_16;
7966  PyObject *__pyx_t_17 = NULL;
7967  PyObject *__pyx_t_18 = NULL;
7968  PyObject *__pyx_t_19 = NULL;
7969  PyObject *__pyx_t_20 = NULL;
7970  PyObject *__pyx_t_21 = NULL;
7971  int __pyx_t_22;
7972  PyObject *__pyx_t_23 = NULL;
7973  PyObject *__pyx_t_24 = NULL;
7974  double __pyx_t_25;
7975  Py_ssize_t __pyx_t_26;
7976  Py_ssize_t __pyx_t_27;
7977  Py_ssize_t __pyx_t_28;
7978  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
7979  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
7980  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
7981  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
7982  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
7983  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
7984  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
7985  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
7986  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
7987  __pyx_pybuffer_x.pybuffer.buf = NULL;
7988  __pyx_pybuffer_x.refcount = 0;
7989  __pyx_pybuffernd_x.data = NULL;
7990  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
7991  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
7992  __pyx_pybuffer_ebq_global_vals.refcount = 0;
7993  __pyx_pybuffernd_ebq_global_vals.data = NULL;
7994  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
7995  {
7996  __Pyx_BufFmt_StackElem __pyx_stack[1];
7997  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
7998  }
7999  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
8000  {
8001  __Pyx_BufFmt_StackElem __pyx_stack[1];
8002  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8003  }
8004  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
8005  {
8006  __Pyx_BufFmt_StackElem __pyx_stack[1];
8007  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8008  }
8009  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
8010  {
8011  __Pyx_BufFmt_StackElem __pyx_stack[1];
8012  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8013  }
8014  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
8015 
8016  /* "subsurfaceTransportFunctions.pyx":288
8017  * cdef double numer,denom
8018  *
8019  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
8020  * material_left = elementBoundaryTypes[ebN,0]
8021  * material_right= elementBoundaryTypes[ebN,1]
8022  */
8023  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
8024  __pyx_t_2 = __pyx_t_1;
8025  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
8026  __pyx_v_ebN = __pyx_t_3;
8027 
8028  /* "subsurfaceTransportFunctions.pyx":289
8029  *
8030  * for ebN in range(x.shape[0]):
8031  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
8032  * material_right= elementBoundaryTypes[ebN,1]
8033  * for k in range(x.shape[1]):
8034  */
8035  __pyx_t_4 = __pyx_v_ebN;
8036  __pyx_t_5 = 0;
8037  __pyx_t_6 = -1;
8038  if (__pyx_t_4 < 0) {
8039  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
8040  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
8041  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
8042  if (__pyx_t_5 < 0) {
8043  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
8044  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
8045  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
8046  if (unlikely(__pyx_t_6 != -1)) {
8047  __Pyx_RaiseBufferIndexError(__pyx_t_6);
8048  __PYX_ERR(0, 289, __pyx_L1_error)
8049  }
8050  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
8051 
8052  /* "subsurfaceTransportFunctions.pyx":290
8053  * for ebN in range(x.shape[0]):
8054  * material_left = elementBoundaryTypes[ebN,0]
8055  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
8056  * for k in range(x.shape[1]):
8057  * for I in range(nd):
8058  */
8059  __pyx_t_7 = __pyx_v_ebN;
8060  __pyx_t_8 = 1;
8061  __pyx_t_6 = -1;
8062  if (__pyx_t_7 < 0) {
8063  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
8064  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
8065  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
8066  if (__pyx_t_8 < 0) {
8067  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
8068  if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 1;
8069  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
8070  if (unlikely(__pyx_t_6 != -1)) {
8071  __Pyx_RaiseBufferIndexError(__pyx_t_6);
8072  __PYX_ERR(0, 290, __pyx_L1_error)
8073  }
8074  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
8075 
8076  /* "subsurfaceTransportFunctions.pyx":291
8077  * material_left = elementBoundaryTypes[ebN,0]
8078  * material_right= elementBoundaryTypes[ebN,1]
8079  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
8080  * for I in range(nd):
8081  * for J in range(nd):
8082  */
8083  __pyx_t_9 = (__pyx_v_x->dimensions[1]);
8084  __pyx_t_10 = __pyx_t_9;
8085  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_10; __pyx_t_6+=1) {
8086  __pyx_v_k = __pyx_t_6;
8087 
8088  /* "subsurfaceTransportFunctions.pyx":292
8089  * material_right= elementBoundaryTypes[ebN,1]
8090  * for k in range(x.shape[1]):
8091  * for I in range(nd): # <<<<<<<<<<<<<<
8092  * for J in range(nd):
8093  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8094  */
8095  __pyx_t_11 = __pyx_v_nd;
8096  __pyx_t_12 = __pyx_t_11;
8097  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
8098  __pyx_v_I = __pyx_t_13;
8099 
8100  /* "subsurfaceTransportFunctions.pyx":293
8101  * for k in range(x.shape[1]):
8102  * for I in range(nd):
8103  * for J in range(nd): # <<<<<<<<<<<<<<
8104  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8105  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8106  */
8107  __pyx_t_14 = __pyx_v_nd;
8108  __pyx_t_15 = __pyx_t_14;
8109  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
8110  __pyx_v_J = __pyx_t_16;
8111 
8112  /* "subsurfaceTransportFunctions.pyx":294
8113  * for I in range(nd):
8114  * for J in range(nd):
8115  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J] # <<<<<<<<<<<<<<
8116  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8117  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
8118  */
8119  if (unlikely(__pyx_v_material_functions == Py_None)) {
8120  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8121  __PYX_ERR(0, 294, __pyx_L1_error)
8122  }
8123  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8124  __Pyx_GOTREF(__pyx_t_18);
8125  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8126  __Pyx_GOTREF(__pyx_t_19);
8127  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8128  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8129  __Pyx_GOTREF(__pyx_t_18);
8130  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 294, __pyx_L1_error)
8131  __Pyx_GOTREF(__pyx_t_20);
8132  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8133  __Pyx_GOTREF(__pyx_t_21);
8134  __Pyx_GIVEREF(__pyx_t_18);
8135  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_18);
8136  __Pyx_GIVEREF(__pyx_t_20);
8137  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_20);
8138  __pyx_t_18 = 0;
8139  __pyx_t_20 = 0;
8140  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 294, __pyx_L1_error)
8141  __Pyx_GOTREF(__pyx_t_20);
8142  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8143  __pyx_t_21 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8144  __Pyx_GOTREF(__pyx_t_21);
8145  __pyx_t_18 = NULL;
8146  __pyx_t_22 = 0;
8147  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
8148  __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_19);
8149  if (likely(__pyx_t_18)) {
8150  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
8151  __Pyx_INCREF(__pyx_t_18);
8152  __Pyx_INCREF(function);
8153  __Pyx_DECREF_SET(__pyx_t_19, function);
8154  __pyx_t_22 = 1;
8155  }
8156  }
8157  #if CYTHON_FAST_PYCALL
8158  if (PyFunction_Check(__pyx_t_19)) {
8159  PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_20, __pyx_t_21};
8160  __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8161  __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
8162  __Pyx_GOTREF(__pyx_t_17);
8163  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8164  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8165  } else
8166  #endif
8167  #if CYTHON_FAST_PYCCALL
8168  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
8169  PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_20, __pyx_t_21};
8170  __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8171  __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
8172  __Pyx_GOTREF(__pyx_t_17);
8173  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8174  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8175  } else
8176  #endif
8177  {
8178  __pyx_t_23 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8179  __Pyx_GOTREF(__pyx_t_23);
8180  if (__pyx_t_18) {
8181  __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_18); __pyx_t_18 = NULL;
8182  }
8183  __Pyx_GIVEREF(__pyx_t_20);
8184  PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_22, __pyx_t_20);
8185  __Pyx_GIVEREF(__pyx_t_21);
8186  PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_22, __pyx_t_21);
8187  __pyx_t_20 = 0;
8188  __pyx_t_21 = 0;
8189  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_23, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8190  __Pyx_GOTREF(__pyx_t_17);
8191  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8192  }
8193  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8194  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8195  __Pyx_GOTREF(__pyx_t_19);
8196  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8197  __Pyx_GOTREF(__pyx_t_23);
8198  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8199  __Pyx_GOTREF(__pyx_t_21);
8200  __Pyx_GIVEREF(__pyx_t_19);
8201  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_19);
8202  __Pyx_GIVEREF(__pyx_t_23);
8203  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_23);
8204  __pyx_t_19 = 0;
8205  __pyx_t_23 = 0;
8206  __pyx_t_23 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_t_21); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8207  __Pyx_GOTREF(__pyx_t_23);
8208  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8209  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8210  __pyx_t_21 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_23); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8211  __Pyx_GOTREF(__pyx_t_21);
8212  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8213  if (unlikely(__pyx_v_material_functions == Py_None)) {
8214  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8215  __PYX_ERR(0, 294, __pyx_L1_error)
8216  }
8217  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8218  __Pyx_GOTREF(__pyx_t_17);
8219  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8220  __Pyx_GOTREF(__pyx_t_19);
8221  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8222  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8223  __Pyx_GOTREF(__pyx_t_17);
8224  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 294, __pyx_L1_error)
8225  __Pyx_GOTREF(__pyx_t_20);
8226  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8227  __Pyx_GOTREF(__pyx_t_18);
8228  __Pyx_GIVEREF(__pyx_t_17);
8229  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17);
8230  __Pyx_GIVEREF(__pyx_t_20);
8231  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_20);
8232  __pyx_t_17 = 0;
8233  __pyx_t_20 = 0;
8234  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_18); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 294, __pyx_L1_error)
8235  __Pyx_GOTREF(__pyx_t_20);
8236  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8237  __pyx_t_18 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8238  __Pyx_GOTREF(__pyx_t_18);
8239  __pyx_t_17 = NULL;
8240  __pyx_t_22 = 0;
8241  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
8242  __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_19);
8243  if (likely(__pyx_t_17)) {
8244  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
8245  __Pyx_INCREF(__pyx_t_17);
8246  __Pyx_INCREF(function);
8247  __Pyx_DECREF_SET(__pyx_t_19, function);
8248  __pyx_t_22 = 1;
8249  }
8250  }
8251  #if CYTHON_FAST_PYCALL
8252  if (PyFunction_Check(__pyx_t_19)) {
8253  PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_20, __pyx_t_18};
8254  __pyx_t_23 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8255  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
8256  __Pyx_GOTREF(__pyx_t_23);
8257  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8258  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8259  } else
8260  #endif
8261  #if CYTHON_FAST_PYCCALL
8262  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
8263  PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_20, __pyx_t_18};
8264  __pyx_t_23 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8265  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
8266  __Pyx_GOTREF(__pyx_t_23);
8267  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8268  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8269  } else
8270  #endif
8271  {
8272  __pyx_t_24 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 294, __pyx_L1_error)
8273  __Pyx_GOTREF(__pyx_t_24);
8274  if (__pyx_t_17) {
8275  __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_17); __pyx_t_17 = NULL;
8276  }
8277  __Pyx_GIVEREF(__pyx_t_20);
8278  PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_22, __pyx_t_20);
8279  __Pyx_GIVEREF(__pyx_t_18);
8280  PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_22, __pyx_t_18);
8281  __pyx_t_20 = 0;
8282  __pyx_t_18 = 0;
8283  __pyx_t_23 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_24, NULL); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 294, __pyx_L1_error)
8284  __Pyx_GOTREF(__pyx_t_23);
8285  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8286  }
8287  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8288  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8289  __Pyx_GOTREF(__pyx_t_19);
8290  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 294, __pyx_L1_error)
8291  __Pyx_GOTREF(__pyx_t_24);
8292  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8293  __Pyx_GOTREF(__pyx_t_18);
8294  __Pyx_GIVEREF(__pyx_t_19);
8295  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_19);
8296  __Pyx_GIVEREF(__pyx_t_24);
8297  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_24);
8298  __pyx_t_19 = 0;
8299  __pyx_t_24 = 0;
8300  __pyx_t_24 = __Pyx_PyObject_GetItem(__pyx_t_23, __pyx_t_18); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 294, __pyx_L1_error)
8301  __Pyx_GOTREF(__pyx_t_24);
8302  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8303  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8304  __pyx_t_18 = PyNumber_Multiply(__pyx_t_21, __pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8305  __Pyx_GOTREF(__pyx_t_18);
8306  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8307  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8308  __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_18); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L1_error)
8309  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8310  __pyx_v_numer = __pyx_t_25;
8311 
8312  /* "subsurfaceTransportFunctions.pyx":295
8313  * for J in range(nd):
8314  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8315  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
8316  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
8317  *
8318  */
8319  if (unlikely(__pyx_v_material_functions == Py_None)) {
8320  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8321  __PYX_ERR(0, 295, __pyx_L1_error)
8322  }
8323  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8324  __Pyx_GOTREF(__pyx_t_24);
8325  __pyx_t_21 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_24); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8326  __Pyx_GOTREF(__pyx_t_21);
8327  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8328  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8329  __Pyx_GOTREF(__pyx_t_24);
8330  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 295, __pyx_L1_error)
8331  __Pyx_GOTREF(__pyx_t_23);
8332  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8333  __Pyx_GOTREF(__pyx_t_19);
8334  __Pyx_GIVEREF(__pyx_t_24);
8335  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_24);
8336  __Pyx_GIVEREF(__pyx_t_23);
8337  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_23);
8338  __pyx_t_24 = 0;
8339  __pyx_t_23 = 0;
8340  __pyx_t_23 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_19); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 295, __pyx_L1_error)
8341  __Pyx_GOTREF(__pyx_t_23);
8342  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8343  __pyx_t_19 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8344  __Pyx_GOTREF(__pyx_t_19);
8345  __pyx_t_24 = NULL;
8346  __pyx_t_22 = 0;
8347  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
8348  __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_21);
8349  if (likely(__pyx_t_24)) {
8350  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
8351  __Pyx_INCREF(__pyx_t_24);
8352  __Pyx_INCREF(function);
8353  __Pyx_DECREF_SET(__pyx_t_21, function);
8354  __pyx_t_22 = 1;
8355  }
8356  }
8357  #if CYTHON_FAST_PYCALL
8358  if (PyFunction_Check(__pyx_t_21)) {
8359  PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_23, __pyx_t_19};
8360  __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8361  __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
8362  __Pyx_GOTREF(__pyx_t_18);
8363  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8364  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8365  } else
8366  #endif
8367  #if CYTHON_FAST_PYCCALL
8368  if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
8369  PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_23, __pyx_t_19};
8370  __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8371  __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
8372  __Pyx_GOTREF(__pyx_t_18);
8373  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8374  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8375  } else
8376  #endif
8377  {
8378  __pyx_t_20 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
8379  __Pyx_GOTREF(__pyx_t_20);
8380  if (__pyx_t_24) {
8381  __Pyx_GIVEREF(__pyx_t_24); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_24); __pyx_t_24 = NULL;
8382  }
8383  __Pyx_GIVEREF(__pyx_t_23);
8384  PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_22, __pyx_t_23);
8385  __Pyx_GIVEREF(__pyx_t_19);
8386  PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_22, __pyx_t_19);
8387  __pyx_t_23 = 0;
8388  __pyx_t_19 = 0;
8389  __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_20, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8390  __Pyx_GOTREF(__pyx_t_18);
8391  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8392  }
8393  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8394  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8395  __Pyx_GOTREF(__pyx_t_21);
8396  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
8397  __Pyx_GOTREF(__pyx_t_20);
8398  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8399  __Pyx_GOTREF(__pyx_t_19);
8400  __Pyx_GIVEREF(__pyx_t_21);
8401  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_21);
8402  __Pyx_GIVEREF(__pyx_t_20);
8403  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_20);
8404  __pyx_t_21 = 0;
8405  __pyx_t_20 = 0;
8406  __pyx_t_20 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_19); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
8407  __Pyx_GOTREF(__pyx_t_20);
8408  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8409  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8410  if (unlikely(__pyx_v_material_functions == Py_None)) {
8411  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8412  __PYX_ERR(0, 295, __pyx_L1_error)
8413  }
8414  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8415  __Pyx_GOTREF(__pyx_t_18);
8416  __pyx_t_21 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8417  __Pyx_GOTREF(__pyx_t_21);
8418  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8419  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8420  __Pyx_GOTREF(__pyx_t_18);
8421  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 295, __pyx_L1_error)
8422  __Pyx_GOTREF(__pyx_t_23);
8423  __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8424  __Pyx_GOTREF(__pyx_t_24);
8425  __Pyx_GIVEREF(__pyx_t_18);
8426  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_18);
8427  __Pyx_GIVEREF(__pyx_t_23);
8428  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_23);
8429  __pyx_t_18 = 0;
8430  __pyx_t_23 = 0;
8431  __pyx_t_23 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_24); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 295, __pyx_L1_error)
8432  __Pyx_GOTREF(__pyx_t_23);
8433  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8434  __pyx_t_24 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8435  __Pyx_GOTREF(__pyx_t_24);
8436  __pyx_t_18 = NULL;
8437  __pyx_t_22 = 0;
8438  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
8439  __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_21);
8440  if (likely(__pyx_t_18)) {
8441  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
8442  __Pyx_INCREF(__pyx_t_18);
8443  __Pyx_INCREF(function);
8444  __Pyx_DECREF_SET(__pyx_t_21, function);
8445  __pyx_t_22 = 1;
8446  }
8447  }
8448  #if CYTHON_FAST_PYCALL
8449  if (PyFunction_Check(__pyx_t_21)) {
8450  PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_23, __pyx_t_24};
8451  __pyx_t_19 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8452  __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
8453  __Pyx_GOTREF(__pyx_t_19);
8454  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8455  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8456  } else
8457  #endif
8458  #if CYTHON_FAST_PYCCALL
8459  if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
8460  PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_23, __pyx_t_24};
8461  __pyx_t_19 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8462  __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
8463  __Pyx_GOTREF(__pyx_t_19);
8464  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
8465  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8466  } else
8467  #endif
8468  {
8469  __pyx_t_17 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8470  __Pyx_GOTREF(__pyx_t_17);
8471  if (__pyx_t_18) {
8472  __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_18); __pyx_t_18 = NULL;
8473  }
8474  __Pyx_GIVEREF(__pyx_t_23);
8475  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_22, __pyx_t_23);
8476  __Pyx_GIVEREF(__pyx_t_24);
8477  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_22, __pyx_t_24);
8478  __pyx_t_23 = 0;
8479  __pyx_t_24 = 0;
8480  __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_17, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8481  __Pyx_GOTREF(__pyx_t_19);
8482  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8483  }
8484  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8485  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8486  __Pyx_GOTREF(__pyx_t_21);
8487  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8488  __Pyx_GOTREF(__pyx_t_17);
8489  __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8490  __Pyx_GOTREF(__pyx_t_24);
8491  __Pyx_GIVEREF(__pyx_t_21);
8492  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_21);
8493  __Pyx_GIVEREF(__pyx_t_17);
8494  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_17);
8495  __pyx_t_21 = 0;
8496  __pyx_t_17 = 0;
8497  __pyx_t_17 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_24); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8498  __Pyx_GOTREF(__pyx_t_17);
8499  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8500  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8501  __pyx_t_24 = PyNumber_Add(__pyx_t_20, __pyx_t_17); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 295, __pyx_L1_error)
8502  __Pyx_GOTREF(__pyx_t_24);
8503  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8504  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8505  __pyx_t_17 = __Pyx_PyFloat_AddObjC(__pyx_t_24, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8506  __Pyx_GOTREF(__pyx_t_17);
8507  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
8508  __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_17); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L1_error)
8509  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8510  __pyx_v_denom = __pyx_t_25;
8511 
8512  /* "subsurfaceTransportFunctions.pyx":296
8513  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8514  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8515  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
8516  *
8517  *
8518  */
8519  if (unlikely(__pyx_v_denom == 0)) {
8520  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
8521  __PYX_ERR(0, 296, __pyx_L1_error)
8522  }
8523  __pyx_t_26 = __pyx_v_ebN;
8524  __pyx_t_27 = __pyx_v_k;
8525  __pyx_t_28 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
8526  __pyx_t_22 = -1;
8527  if (__pyx_t_26 < 0) {
8528  __pyx_t_26 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
8529  if (unlikely(__pyx_t_26 < 0)) __pyx_t_22 = 0;
8530  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_22 = 0;
8531  if (__pyx_t_27 < 0) {
8532  __pyx_t_27 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
8533  if (unlikely(__pyx_t_27 < 0)) __pyx_t_22 = 1;
8534  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_22 = 1;
8535  if (__pyx_t_28 < 0) {
8536  __pyx_t_28 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
8537  if (unlikely(__pyx_t_28 < 0)) __pyx_t_22 = 2;
8538  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_22 = 2;
8539  if (unlikely(__pyx_t_22 != -1)) {
8540  __Pyx_RaiseBufferIndexError(__pyx_t_22);
8541  __PYX_ERR(0, 296, __pyx_L1_error)
8542  }
8543  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_28, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
8544  }
8545  }
8546  }
8547  }
8548 
8549  /* "subsurfaceTransportFunctions.pyx":271
8550  *
8551  *
8552  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
8553  * double t,
8554  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
8555  */
8556 
8557  /* function exit code */
8558  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8559  goto __pyx_L0;
8560  __pyx_L1_error:;
8561  __Pyx_XDECREF(__pyx_t_17);
8562  __Pyx_XDECREF(__pyx_t_18);
8563  __Pyx_XDECREF(__pyx_t_19);
8564  __Pyx_XDECREF(__pyx_t_20);
8565  __Pyx_XDECREF(__pyx_t_21);
8566  __Pyx_XDECREF(__pyx_t_23);
8567  __Pyx_XDECREF(__pyx_t_24);
8568  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
8569  __Pyx_PyThreadState_declare
8570  __Pyx_PyThreadState_assign
8571  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
8572  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8573  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8574  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8575  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8576  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
8577  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
8578  __pyx_r = NULL;
8579  goto __pyx_L2;
8580  __pyx_L0:;
8581  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8582  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8583  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8584  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8585  __pyx_L2:;
8586  __Pyx_XGIVEREF(__pyx_r);
8587  __Pyx_RefNannyFinishContext();
8588  return __pyx_r;
8589 }
8590 
8591 /* "subsurfaceTransportFunctions.pyx":301
8592  *
8593  * ##################################################
8594  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
8595  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
8596  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
8597  */
8598 
8599 /* Python wrapper */
8600 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8601 static char __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear[] = "\n routine for evaluating linaer interface (nodal) coefficients in NCP1 approximation for Darcy Flow\n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
8602 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear = {"RE_NCP1_evaluateElementCoefficients_Linear", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear};
8603 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8604  double __pyx_v_rho;
8605  PyArrayObject *__pyx_v_gravity = 0;
8606  PyArrayObject *__pyx_v_rowptr = 0;
8607  PyArrayObject *__pyx_v_colind = 0;
8608  PyArrayObject *__pyx_v_KWs = 0;
8609  int __pyx_v_nSpace;
8610  int __pyx_v_nElements_global;
8611  int __pyx_v_nElementBoundaries_element;
8612  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
8613  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
8614  PyArrayObject *__pyx_v_q_flin = 0;
8615  PyArrayObject *__pyx_v_q_alin = 0;
8616  PyObject *__pyx_r = 0;
8617  __Pyx_RefNannyDeclarations
8618  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear (wrapper)", 0);
8619  {
8620  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_KWs,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,0};
8621  PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
8622  if (unlikely(__pyx_kwds)) {
8623  Py_ssize_t kw_args;
8624  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8625  switch (pos_args) {
8626  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8627  CYTHON_FALLTHROUGH;
8628  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8629  CYTHON_FALLTHROUGH;
8630  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8631  CYTHON_FALLTHROUGH;
8632  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8633  CYTHON_FALLTHROUGH;
8634  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8635  CYTHON_FALLTHROUGH;
8636  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8637  CYTHON_FALLTHROUGH;
8638  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8639  CYTHON_FALLTHROUGH;
8640  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8641  CYTHON_FALLTHROUGH;
8642  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8643  CYTHON_FALLTHROUGH;
8644  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8645  CYTHON_FALLTHROUGH;
8646  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8647  CYTHON_FALLTHROUGH;
8648  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8649  CYTHON_FALLTHROUGH;
8650  case 0: break;
8651  default: goto __pyx_L5_argtuple_error;
8652  }
8653  kw_args = PyDict_Size(__pyx_kwds);
8654  switch (pos_args) {
8655  case 0:
8656  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
8657  else goto __pyx_L5_argtuple_error;
8658  CYTHON_FALLTHROUGH;
8659  case 1:
8660  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
8661  else {
8662  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 1); __PYX_ERR(0, 301, __pyx_L3_error)
8663  }
8664  CYTHON_FALLTHROUGH;
8665  case 2:
8666  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
8667  else {
8668  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 2); __PYX_ERR(0, 301, __pyx_L3_error)
8669  }
8670  CYTHON_FALLTHROUGH;
8671  case 3:
8672  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
8673  else {
8674  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 3); __PYX_ERR(0, 301, __pyx_L3_error)
8675  }
8676  CYTHON_FALLTHROUGH;
8677  case 4:
8678  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_KWs)) != 0)) kw_args--;
8679  else {
8680  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 4); __PYX_ERR(0, 301, __pyx_L3_error)
8681  }
8682  CYTHON_FALLTHROUGH;
8683  case 5:
8684  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
8685  else {
8686  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 5); __PYX_ERR(0, 301, __pyx_L3_error)
8687  }
8688  CYTHON_FALLTHROUGH;
8689  case 6:
8690  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
8691  else {
8692  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 6); __PYX_ERR(0, 301, __pyx_L3_error)
8693  }
8694  CYTHON_FALLTHROUGH;
8695  case 7:
8696  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
8697  else {
8698  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 7); __PYX_ERR(0, 301, __pyx_L3_error)
8699  }
8700  CYTHON_FALLTHROUGH;
8701  case 8:
8702  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
8703  else {
8704  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 8); __PYX_ERR(0, 301, __pyx_L3_error)
8705  }
8706  CYTHON_FALLTHROUGH;
8707  case 9:
8708  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
8709  else {
8710  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 9); __PYX_ERR(0, 301, __pyx_L3_error)
8711  }
8712  CYTHON_FALLTHROUGH;
8713  case 10:
8714  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
8715  else {
8716  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 10); __PYX_ERR(0, 301, __pyx_L3_error)
8717  }
8718  CYTHON_FALLTHROUGH;
8719  case 11:
8720  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
8721  else {
8722  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 11); __PYX_ERR(0, 301, __pyx_L3_error)
8723  }
8724  }
8725  if (unlikely(kw_args > 0)) {
8726  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_Linear") < 0)) __PYX_ERR(0, 301, __pyx_L3_error)
8727  }
8728  } else if (PyTuple_GET_SIZE(__pyx_args) != 12) {
8729  goto __pyx_L5_argtuple_error;
8730  } else {
8731  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8732  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8733  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8734  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8735  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8736  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8737  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8738  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8739  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8740  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8741  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8742  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8743  }
8744  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L3_error)
8745  __pyx_v_gravity = ((PyArrayObject *)values[1]);
8746  __pyx_v_rowptr = ((PyArrayObject *)values[2]);
8747  __pyx_v_colind = ((PyArrayObject *)values[3]);
8748  __pyx_v_KWs = ((PyArrayObject *)values[4]);
8749  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error)
8750  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
8751  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error)
8752  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[8]);
8753  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[9]);
8754  __pyx_v_q_flin = ((PyArrayObject *)values[10]);
8755  __pyx_v_q_alin = ((PyArrayObject *)values[11]);
8756  }
8757  goto __pyx_L4_argument_unpacking_done;
8758  __pyx_L5_argtuple_error:;
8759  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 301, __pyx_L3_error)
8760  __pyx_L3_error:;
8761  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
8762  __Pyx_RefNannyFinishContext();
8763  return NULL;
8764  __pyx_L4_argument_unpacking_done:;
8765  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 302, __pyx_L1_error)
8766  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 303, __pyx_L1_error)
8767  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 304, __pyx_L1_error)
8768  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_KWs), __pyx_ptype_5numpy_ndarray, 1, "KWs", 0))) __PYX_ERR(0, 305, __pyx_L1_error)
8769  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 310, __pyx_L1_error)
8770  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 311, __pyx_L1_error)
8771  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 312, __pyx_L1_error)
8772  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 313, __pyx_L1_error)
8773  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(__pyx_self, __pyx_v_rho, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_KWs, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementMaterialTypes, __pyx_v_q_flin, __pyx_v_q_alin);
8774 
8775  /* function exit code */
8776  goto __pyx_L0;
8777  __pyx_L1_error:;
8778  __pyx_r = NULL;
8779  __pyx_L0:;
8780  __Pyx_RefNannyFinishContext();
8781  return __pyx_r;
8782 }
8783 
8784 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin) {
8785  int __pyx_v_eN;
8786  int __pyx_v_eN_neighbor;
8787  int __pyx_v_ii;
8788  int __pyx_v_I;
8789  int __pyx_v_ebN;
8790  int __pyx_v_matID;
8791  int __pyx_v_matID_neig;
8792  CYTHON_UNUSED int __pyx_v_nSpace2;
8793  int __pyx_v_nnz;
8794  PyArrayObject *__pyx_v_a_eN = 0;
8795  PyArrayObject *__pyx_v_a_neig = 0;
8796  PyArrayObject *__pyx_v_a_avg = 0;
8797  __Pyx_LocalBuf_ND __pyx_pybuffernd_KWs;
8798  __Pyx_Buffer __pyx_pybuffer_KWs;
8799  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_avg;
8800  __Pyx_Buffer __pyx_pybuffer_a_avg;
8801  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_eN;
8802  __Pyx_Buffer __pyx_pybuffer_a_eN;
8803  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_neig;
8804  __Pyx_Buffer __pyx_pybuffer_a_neig;
8805  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
8806  __Pyx_Buffer __pyx_pybuffer_colind;
8807  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
8808  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
8809  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
8810  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
8811  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
8812  __Pyx_Buffer __pyx_pybuffer_gravity;
8813  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
8814  __Pyx_Buffer __pyx_pybuffer_q_alin;
8815  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
8816  __Pyx_Buffer __pyx_pybuffer_q_flin;
8817  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
8818  __Pyx_Buffer __pyx_pybuffer_rowptr;
8819  PyObject *__pyx_r = NULL;
8820  __Pyx_RefNannyDeclarations
8821  Py_ssize_t __pyx_t_1;
8822  int __pyx_t_2;
8823  PyObject *__pyx_t_3 = NULL;
8824  PyObject *__pyx_t_4 = NULL;
8825  PyObject *__pyx_t_5 = NULL;
8826  PyObject *__pyx_t_6 = NULL;
8827  PyObject *__pyx_t_7 = NULL;
8828  PyArrayObject *__pyx_t_8 = NULL;
8829  PyArrayObject *__pyx_t_9 = NULL;
8830  PyArrayObject *__pyx_t_10 = NULL;
8831  int __pyx_t_11;
8832  int __pyx_t_12;
8833  Py_ssize_t __pyx_t_13;
8834  int __pyx_t_14;
8835  int __pyx_t_15;
8836  int __pyx_t_16;
8837  Py_ssize_t __pyx_t_17;
8838  Py_ssize_t __pyx_t_18;
8839  int __pyx_t_19;
8840  Py_ssize_t __pyx_t_20;
8841  Py_ssize_t __pyx_t_21;
8842  Py_ssize_t __pyx_t_22;
8843  int __pyx_t_23;
8844  int __pyx_t_24;
8845  Py_ssize_t __pyx_t_25;
8846  int __pyx_t_26;
8847  Py_ssize_t __pyx_t_27;
8848  int __pyx_t_28;
8849  Py_ssize_t __pyx_t_29;
8850  Py_ssize_t __pyx_t_30;
8851  Py_ssize_t __pyx_t_31;
8852  Py_ssize_t __pyx_t_32;
8853  Py_ssize_t __pyx_t_33;
8854  Py_ssize_t __pyx_t_34;
8855  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_35;
8856  Py_ssize_t __pyx_t_36;
8857  Py_ssize_t __pyx_t_37;
8858  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_38;
8859  Py_ssize_t __pyx_t_39;
8860  Py_ssize_t __pyx_t_40;
8861  Py_ssize_t __pyx_t_41;
8862  Py_ssize_t __pyx_t_42;
8863  Py_ssize_t __pyx_t_43;
8864  Py_ssize_t __pyx_t_44;
8865  Py_ssize_t __pyx_t_45;
8866  Py_ssize_t __pyx_t_46;
8867  Py_ssize_t __pyx_t_47;
8868  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_48;
8869  Py_ssize_t __pyx_t_49;
8870  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_50;
8871  Py_ssize_t __pyx_t_51;
8872  int __pyx_t_52;
8873  Py_ssize_t __pyx_t_53;
8874  Py_ssize_t __pyx_t_54;
8875  Py_ssize_t __pyx_t_55;
8876  Py_ssize_t __pyx_t_56;
8877  Py_ssize_t __pyx_t_57;
8878  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear", 0);
8879  __pyx_pybuffer_a_eN.pybuffer.buf = NULL;
8880  __pyx_pybuffer_a_eN.refcount = 0;
8881  __pyx_pybuffernd_a_eN.data = NULL;
8882  __pyx_pybuffernd_a_eN.rcbuffer = &__pyx_pybuffer_a_eN;
8883  __pyx_pybuffer_a_neig.pybuffer.buf = NULL;
8884  __pyx_pybuffer_a_neig.refcount = 0;
8885  __pyx_pybuffernd_a_neig.data = NULL;
8886  __pyx_pybuffernd_a_neig.rcbuffer = &__pyx_pybuffer_a_neig;
8887  __pyx_pybuffer_a_avg.pybuffer.buf = NULL;
8888  __pyx_pybuffer_a_avg.refcount = 0;
8889  __pyx_pybuffernd_a_avg.data = NULL;
8890  __pyx_pybuffernd_a_avg.rcbuffer = &__pyx_pybuffer_a_avg;
8891  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
8892  __pyx_pybuffer_gravity.refcount = 0;
8893  __pyx_pybuffernd_gravity.data = NULL;
8894  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
8895  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
8896  __pyx_pybuffer_rowptr.refcount = 0;
8897  __pyx_pybuffernd_rowptr.data = NULL;
8898  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
8899  __pyx_pybuffer_colind.pybuffer.buf = NULL;
8900  __pyx_pybuffer_colind.refcount = 0;
8901  __pyx_pybuffernd_colind.data = NULL;
8902  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
8903  __pyx_pybuffer_KWs.pybuffer.buf = NULL;
8904  __pyx_pybuffer_KWs.refcount = 0;
8905  __pyx_pybuffernd_KWs.data = NULL;
8906  __pyx_pybuffernd_KWs.rcbuffer = &__pyx_pybuffer_KWs;
8907  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
8908  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
8909  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
8910  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
8911  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
8912  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
8913  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
8914  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
8915  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
8916  __pyx_pybuffer_q_flin.refcount = 0;
8917  __pyx_pybuffernd_q_flin.data = NULL;
8918  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
8919  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
8920  __pyx_pybuffer_q_alin.refcount = 0;
8921  __pyx_pybuffernd_q_alin.data = NULL;
8922  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
8923  {
8924  __Pyx_BufFmt_StackElem __pyx_stack[1];
8925  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8926  }
8927  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
8928  {
8929  __Pyx_BufFmt_StackElem __pyx_stack[1];
8930  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8931  }
8932  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
8933  {
8934  __Pyx_BufFmt_StackElem __pyx_stack[1];
8935  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8936  }
8937  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
8938  {
8939  __Pyx_BufFmt_StackElem __pyx_stack[1];
8940  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer, (PyObject*)__pyx_v_KWs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8941  }
8942  __pyx_pybuffernd_KWs.diminfo[0].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_KWs.diminfo[0].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_KWs.diminfo[1].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_KWs.diminfo[1].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[1];
8943  {
8944  __Pyx_BufFmt_StackElem __pyx_stack[1];
8945  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8946  }
8947  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
8948  {
8949  __Pyx_BufFmt_StackElem __pyx_stack[1];
8950  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8951  }
8952  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
8953  {
8954  __Pyx_BufFmt_StackElem __pyx_stack[1];
8955  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8956  }
8957  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
8958  {
8959  __Pyx_BufFmt_StackElem __pyx_stack[1];
8960  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8961  }
8962  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
8963 
8964  /* "subsurfaceTransportFunctions.pyx":328
8965  * #temporaries
8966  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
8967  * cdef int nSpace2 = nSpace*nSpace # <<<<<<<<<<<<<<
8968  * cdef int nnz = rowptr[nSpace]
8969  *
8970  */
8971  __pyx_v_nSpace2 = (__pyx_v_nSpace * __pyx_v_nSpace);
8972 
8973  /* "subsurfaceTransportFunctions.pyx":329
8974  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
8975  * cdef int nSpace2 = nSpace*nSpace
8976  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
8977  *
8978  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
8979  */
8980  __pyx_t_1 = __pyx_v_nSpace;
8981  __pyx_t_2 = -1;
8982  if (__pyx_t_1 < 0) {
8983  __pyx_t_1 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
8984  if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
8985  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_2 = 0;
8986  if (unlikely(__pyx_t_2 != -1)) {
8987  __Pyx_RaiseBufferIndexError(__pyx_t_2);
8988  __PYX_ERR(0, 329, __pyx_L1_error)
8989  }
8990  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_rowptr.diminfo[0].strides));
8991 
8992  /* "subsurfaceTransportFunctions.pyx":331
8993  * cdef int nnz = rowptr[nSpace]
8994  *
8995  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
8996  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
8997  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
8998  */
8999  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
9000  __Pyx_GOTREF(__pyx_t_4);
9001  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
9002  __Pyx_GOTREF(__pyx_t_5);
9003  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9004  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
9005  __Pyx_GOTREF(__pyx_t_4);
9006  __pyx_t_6 = NULL;
9007  __pyx_t_2 = 0;
9008  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
9009  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
9010  if (likely(__pyx_t_6)) {
9011  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9012  __Pyx_INCREF(__pyx_t_6);
9013  __Pyx_INCREF(function);
9014  __Pyx_DECREF_SET(__pyx_t_5, function);
9015  __pyx_t_2 = 1;
9016  }
9017  }
9018  #if CYTHON_FAST_PYCALL
9019  if (PyFunction_Check(__pyx_t_5)) {
9020  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
9021  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9022  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9023  __Pyx_GOTREF(__pyx_t_3);
9024  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9025  } else
9026  #endif
9027  #if CYTHON_FAST_PYCCALL
9028  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
9029  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
9030  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9031  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9032  __Pyx_GOTREF(__pyx_t_3);
9033  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9034  } else
9035  #endif
9036  {
9037  __pyx_t_7 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 331, __pyx_L1_error)
9038  __Pyx_GOTREF(__pyx_t_7);
9039  if (__pyx_t_6) {
9040  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
9041  }
9042  __Pyx_GIVEREF(__pyx_t_4);
9043  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_2, __pyx_t_4);
9044  __Pyx_INCREF(__pyx_n_s_d);
9045  __Pyx_GIVEREF(__pyx_n_s_d);
9046  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_2, __pyx_n_s_d);
9047  __pyx_t_4 = 0;
9048  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9049  __Pyx_GOTREF(__pyx_t_3);
9050  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9051  }
9052  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9053  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 331, __pyx_L1_error)
9054  __pyx_t_8 = ((PyArrayObject *)__pyx_t_3);
9055  {
9056  __Pyx_BufFmt_StackElem __pyx_stack[1];
9057  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9058  __pyx_v_a_eN = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf = NULL;
9059  __PYX_ERR(0, 331, __pyx_L1_error)
9060  } else {__pyx_pybuffernd_a_eN.diminfo[0].strides = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_eN.diminfo[0].shape = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.shape[0];
9061  }
9062  }
9063  __pyx_t_8 = 0;
9064  __pyx_v_a_eN = ((PyArrayObject *)__pyx_t_3);
9065  __pyx_t_3 = 0;
9066 
9067  /* "subsurfaceTransportFunctions.pyx":332
9068  *
9069  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9070  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9071  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
9072  *
9073  */
9074  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
9075  __Pyx_GOTREF(__pyx_t_5);
9076  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 332, __pyx_L1_error)
9077  __Pyx_GOTREF(__pyx_t_7);
9078  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9079  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
9080  __Pyx_GOTREF(__pyx_t_5);
9081  __pyx_t_4 = NULL;
9082  __pyx_t_2 = 0;
9083  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
9084  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
9085  if (likely(__pyx_t_4)) {
9086  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9087  __Pyx_INCREF(__pyx_t_4);
9088  __Pyx_INCREF(function);
9089  __Pyx_DECREF_SET(__pyx_t_7, function);
9090  __pyx_t_2 = 1;
9091  }
9092  }
9093  #if CYTHON_FAST_PYCALL
9094  if (PyFunction_Check(__pyx_t_7)) {
9095  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
9096  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9097  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9098  __Pyx_GOTREF(__pyx_t_3);
9099  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9100  } else
9101  #endif
9102  #if CYTHON_FAST_PYCCALL
9103  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
9104  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
9105  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9106  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9107  __Pyx_GOTREF(__pyx_t_3);
9108  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9109  } else
9110  #endif
9111  {
9112  __pyx_t_6 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 332, __pyx_L1_error)
9113  __Pyx_GOTREF(__pyx_t_6);
9114  if (__pyx_t_4) {
9115  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
9116  }
9117  __Pyx_GIVEREF(__pyx_t_5);
9118  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_2, __pyx_t_5);
9119  __Pyx_INCREF(__pyx_n_s_d);
9120  __Pyx_GIVEREF(__pyx_n_s_d);
9121  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_2, __pyx_n_s_d);
9122  __pyx_t_5 = 0;
9123  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9124  __Pyx_GOTREF(__pyx_t_3);
9125  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9126  }
9127  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9128  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 332, __pyx_L1_error)
9129  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
9130  {
9131  __Pyx_BufFmt_StackElem __pyx_stack[1];
9132  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9133  __pyx_v_a_neig = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf = NULL;
9134  __PYX_ERR(0, 332, __pyx_L1_error)
9135  } else {__pyx_pybuffernd_a_neig.diminfo[0].strides = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_neig.diminfo[0].shape = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.shape[0];
9136  }
9137  }
9138  __pyx_t_9 = 0;
9139  __pyx_v_a_neig = ((PyArrayObject *)__pyx_t_3);
9140  __pyx_t_3 = 0;
9141 
9142  /* "subsurfaceTransportFunctions.pyx":333
9143  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9144  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
9145  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9146  *
9147  * #loop through and evaluate
9148  */
9149  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
9150  __Pyx_GOTREF(__pyx_t_7);
9151  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
9152  __Pyx_GOTREF(__pyx_t_6);
9153  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9154  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
9155  __Pyx_GOTREF(__pyx_t_7);
9156  __pyx_t_5 = NULL;
9157  __pyx_t_2 = 0;
9158  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
9159  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
9160  if (likely(__pyx_t_5)) {
9161  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9162  __Pyx_INCREF(__pyx_t_5);
9163  __Pyx_INCREF(function);
9164  __Pyx_DECREF_SET(__pyx_t_6, function);
9165  __pyx_t_2 = 1;
9166  }
9167  }
9168  #if CYTHON_FAST_PYCALL
9169  if (PyFunction_Check(__pyx_t_6)) {
9170  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
9171  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9172  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9173  __Pyx_GOTREF(__pyx_t_3);
9174  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9175  } else
9176  #endif
9177  #if CYTHON_FAST_PYCCALL
9178  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
9179  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
9180  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9181  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9182  __Pyx_GOTREF(__pyx_t_3);
9183  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9184  } else
9185  #endif
9186  {
9187  __pyx_t_4 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
9188  __Pyx_GOTREF(__pyx_t_4);
9189  if (__pyx_t_5) {
9190  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
9191  }
9192  __Pyx_GIVEREF(__pyx_t_7);
9193  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_2, __pyx_t_7);
9194  __Pyx_INCREF(__pyx_n_s_d);
9195  __Pyx_GIVEREF(__pyx_n_s_d);
9196  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_2, __pyx_n_s_d);
9197  __pyx_t_7 = 0;
9198  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9199  __Pyx_GOTREF(__pyx_t_3);
9200  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9201  }
9202  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9203  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 333, __pyx_L1_error)
9204  __pyx_t_10 = ((PyArrayObject *)__pyx_t_3);
9205  {
9206  __Pyx_BufFmt_StackElem __pyx_stack[1];
9207  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9208  __pyx_v_a_avg = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf = NULL;
9209  __PYX_ERR(0, 333, __pyx_L1_error)
9210  } else {__pyx_pybuffernd_a_avg.diminfo[0].strides = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_avg.diminfo[0].shape = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.shape[0];
9211  }
9212  }
9213  __pyx_t_10 = 0;
9214  __pyx_v_a_avg = ((PyArrayObject *)__pyx_t_3);
9215  __pyx_t_3 = 0;
9216 
9217  /* "subsurfaceTransportFunctions.pyx":336
9218  *
9219  * #loop through and evaluate
9220  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
9221  * matID = elementMaterialTypes[eN]
9222  * for ii in range(nnz):
9223  */
9224  __pyx_t_2 = __pyx_v_nElements_global;
9225  __pyx_t_11 = __pyx_t_2;
9226  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
9227  __pyx_v_eN = __pyx_t_12;
9228 
9229  /* "subsurfaceTransportFunctions.pyx":337
9230  * #loop through and evaluate
9231  * for eN in range(nElements_global):
9232  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
9233  * for ii in range(nnz):
9234  * a_eN[ii] = rho*KWs[matID,ii]
9235  */
9236  __pyx_t_13 = __pyx_v_eN;
9237  __pyx_t_14 = -1;
9238  if (__pyx_t_13 < 0) {
9239  __pyx_t_13 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
9240  if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
9241  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_14 = 0;
9242  if (unlikely(__pyx_t_14 != -1)) {
9243  __Pyx_RaiseBufferIndexError(__pyx_t_14);
9244  __PYX_ERR(0, 337, __pyx_L1_error)
9245  }
9246  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
9247 
9248  /* "subsurfaceTransportFunctions.pyx":338
9249  * for eN in range(nElements_global):
9250  * matID = elementMaterialTypes[eN]
9251  * for ii in range(nnz): # <<<<<<<<<<<<<<
9252  * a_eN[ii] = rho*KWs[matID,ii]
9253  * for ebN in range(nElementBoundaries_element):
9254  */
9255  __pyx_t_14 = __pyx_v_nnz;
9256  __pyx_t_15 = __pyx_t_14;
9257  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
9258  __pyx_v_ii = __pyx_t_16;
9259 
9260  /* "subsurfaceTransportFunctions.pyx":339
9261  * matID = elementMaterialTypes[eN]
9262  * for ii in range(nnz):
9263  * a_eN[ii] = rho*KWs[matID,ii] # <<<<<<<<<<<<<<
9264  * for ebN in range(nElementBoundaries_element):
9265  * eN_neighbor = elementNeighborsArray[eN,ebN]
9266  */
9267  __pyx_t_17 = __pyx_v_matID;
9268  __pyx_t_18 = __pyx_v_ii;
9269  __pyx_t_19 = -1;
9270  if (__pyx_t_17 < 0) {
9271  __pyx_t_17 += __pyx_pybuffernd_KWs.diminfo[0].shape;
9272  if (unlikely(__pyx_t_17 < 0)) __pyx_t_19 = 0;
9273  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_19 = 0;
9274  if (__pyx_t_18 < 0) {
9275  __pyx_t_18 += __pyx_pybuffernd_KWs.diminfo[1].shape;
9276  if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 1;
9277  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_19 = 1;
9278  if (unlikely(__pyx_t_19 != -1)) {
9279  __Pyx_RaiseBufferIndexError(__pyx_t_19);
9280  __PYX_ERR(0, 339, __pyx_L1_error)
9281  }
9282  __pyx_t_20 = __pyx_v_ii;
9283  __pyx_t_19 = -1;
9284  if (__pyx_t_20 < 0) {
9285  __pyx_t_20 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9286  if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 0;
9287  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_19 = 0;
9288  if (unlikely(__pyx_t_19 != -1)) {
9289  __Pyx_RaiseBufferIndexError(__pyx_t_19);
9290  __PYX_ERR(0, 339, __pyx_L1_error)
9291  }
9292  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_a_eN.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_KWs.diminfo[1].strides)));
9293  }
9294 
9295  /* "subsurfaceTransportFunctions.pyx":340
9296  * for ii in range(nnz):
9297  * a_eN[ii] = rho*KWs[matID,ii]
9298  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
9299  * eN_neighbor = elementNeighborsArray[eN,ebN]
9300  * for ii in range(nnz):
9301  */
9302  __pyx_t_14 = __pyx_v_nElementBoundaries_element;
9303  __pyx_t_15 = __pyx_t_14;
9304  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
9305  __pyx_v_ebN = __pyx_t_16;
9306 
9307  /* "subsurfaceTransportFunctions.pyx":341
9308  * a_eN[ii] = rho*KWs[matID,ii]
9309  * for ebN in range(nElementBoundaries_element):
9310  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
9311  * for ii in range(nnz):
9312  * a_neig[ii] = a_eN[ii]
9313  */
9314  __pyx_t_21 = __pyx_v_eN;
9315  __pyx_t_22 = __pyx_v_ebN;
9316  __pyx_t_19 = -1;
9317  if (__pyx_t_21 < 0) {
9318  __pyx_t_21 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
9319  if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 0;
9320  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_19 = 0;
9321  if (__pyx_t_22 < 0) {
9322  __pyx_t_22 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
9323  if (unlikely(__pyx_t_22 < 0)) __pyx_t_19 = 1;
9324  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_19 = 1;
9325  if (unlikely(__pyx_t_19 != -1)) {
9326  __Pyx_RaiseBufferIndexError(__pyx_t_19);
9327  __PYX_ERR(0, 341, __pyx_L1_error)
9328  }
9329  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
9330 
9331  /* "subsurfaceTransportFunctions.pyx":342
9332  * for ebN in range(nElementBoundaries_element):
9333  * eN_neighbor = elementNeighborsArray[eN,ebN]
9334  * for ii in range(nnz): # <<<<<<<<<<<<<<
9335  * a_neig[ii] = a_eN[ii]
9336  * if eN_neighbor >= 0:
9337  */
9338  __pyx_t_19 = __pyx_v_nnz;
9339  __pyx_t_23 = __pyx_t_19;
9340  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
9341  __pyx_v_ii = __pyx_t_24;
9342 
9343  /* "subsurfaceTransportFunctions.pyx":343
9344  * eN_neighbor = elementNeighborsArray[eN,ebN]
9345  * for ii in range(nnz):
9346  * a_neig[ii] = a_eN[ii] # <<<<<<<<<<<<<<
9347  * if eN_neighbor >= 0:
9348  * matID_neig = elementMaterialTypes[eN_neighbor]
9349  */
9350  __pyx_t_25 = __pyx_v_ii;
9351  __pyx_t_26 = -1;
9352  if (__pyx_t_25 < 0) {
9353  __pyx_t_25 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9354  if (unlikely(__pyx_t_25 < 0)) __pyx_t_26 = 0;
9355  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_26 = 0;
9356  if (unlikely(__pyx_t_26 != -1)) {
9357  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9358  __PYX_ERR(0, 343, __pyx_L1_error)
9359  }
9360  __pyx_t_27 = __pyx_v_ii;
9361  __pyx_t_26 = -1;
9362  if (__pyx_t_27 < 0) {
9363  __pyx_t_27 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9364  if (unlikely(__pyx_t_27 < 0)) __pyx_t_26 = 0;
9365  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_26 = 0;
9366  if (unlikely(__pyx_t_26 != -1)) {
9367  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9368  __PYX_ERR(0, 343, __pyx_L1_error)
9369  }
9370  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_a_eN.diminfo[0].strides));
9371  }
9372 
9373  /* "subsurfaceTransportFunctions.pyx":344
9374  * for ii in range(nnz):
9375  * a_neig[ii] = a_eN[ii]
9376  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
9377  * matID_neig = elementMaterialTypes[eN_neighbor]
9378  * for ii in range(nnz):
9379  */
9380  __pyx_t_28 = ((__pyx_v_eN_neighbor >= 0) != 0);
9381  if (__pyx_t_28) {
9382 
9383  /* "subsurfaceTransportFunctions.pyx":345
9384  * a_neig[ii] = a_eN[ii]
9385  * if eN_neighbor >= 0:
9386  * matID_neig = elementMaterialTypes[eN_neighbor] # <<<<<<<<<<<<<<
9387  * for ii in range(nnz):
9388  * a_neig[ii] = rho*KWs[matID_neig,ii]
9389  */
9390  __pyx_t_29 = __pyx_v_eN_neighbor;
9391  __pyx_t_19 = -1;
9392  if (__pyx_t_29 < 0) {
9393  __pyx_t_29 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
9394  if (unlikely(__pyx_t_29 < 0)) __pyx_t_19 = 0;
9395  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_19 = 0;
9396  if (unlikely(__pyx_t_19 != -1)) {
9397  __Pyx_RaiseBufferIndexError(__pyx_t_19);
9398  __PYX_ERR(0, 345, __pyx_L1_error)
9399  }
9400  __pyx_v_matID_neig = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
9401 
9402  /* "subsurfaceTransportFunctions.pyx":346
9403  * if eN_neighbor >= 0:
9404  * matID_neig = elementMaterialTypes[eN_neighbor]
9405  * for ii in range(nnz): # <<<<<<<<<<<<<<
9406  * a_neig[ii] = rho*KWs[matID_neig,ii]
9407  * for ii in range(nnz):
9408  */
9409  __pyx_t_19 = __pyx_v_nnz;
9410  __pyx_t_23 = __pyx_t_19;
9411  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
9412  __pyx_v_ii = __pyx_t_24;
9413 
9414  /* "subsurfaceTransportFunctions.pyx":347
9415  * matID_neig = elementMaterialTypes[eN_neighbor]
9416  * for ii in range(nnz):
9417  * a_neig[ii] = rho*KWs[matID_neig,ii] # <<<<<<<<<<<<<<
9418  * for ii in range(nnz):
9419  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9420  */
9421  __pyx_t_30 = __pyx_v_matID_neig;
9422  __pyx_t_31 = __pyx_v_ii;
9423  __pyx_t_26 = -1;
9424  if (__pyx_t_30 < 0) {
9425  __pyx_t_30 += __pyx_pybuffernd_KWs.diminfo[0].shape;
9426  if (unlikely(__pyx_t_30 < 0)) __pyx_t_26 = 0;
9427  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_26 = 0;
9428  if (__pyx_t_31 < 0) {
9429  __pyx_t_31 += __pyx_pybuffernd_KWs.diminfo[1].shape;
9430  if (unlikely(__pyx_t_31 < 0)) __pyx_t_26 = 1;
9431  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_26 = 1;
9432  if (unlikely(__pyx_t_26 != -1)) {
9433  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9434  __PYX_ERR(0, 347, __pyx_L1_error)
9435  }
9436  __pyx_t_32 = __pyx_v_ii;
9437  __pyx_t_26 = -1;
9438  if (__pyx_t_32 < 0) {
9439  __pyx_t_32 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9440  if (unlikely(__pyx_t_32 < 0)) __pyx_t_26 = 0;
9441  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_26 = 0;
9442  if (unlikely(__pyx_t_26 != -1)) {
9443  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9444  __PYX_ERR(0, 347, __pyx_L1_error)
9445  }
9446  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_KWs.diminfo[1].strides)));
9447  }
9448 
9449  /* "subsurfaceTransportFunctions.pyx":344
9450  * for ii in range(nnz):
9451  * a_neig[ii] = a_eN[ii]
9452  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
9453  * matID_neig = elementMaterialTypes[eN_neighbor]
9454  * for ii in range(nnz):
9455  */
9456  }
9457 
9458  /* "subsurfaceTransportFunctions.pyx":348
9459  * for ii in range(nnz):
9460  * a_neig[ii] = rho*KWs[matID_neig,ii]
9461  * for ii in range(nnz): # <<<<<<<<<<<<<<
9462  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9463  * q_alin[eN,ebN,ii] = a_avg[ii]
9464  */
9465  __pyx_t_19 = __pyx_v_nnz;
9466  __pyx_t_23 = __pyx_t_19;
9467  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
9468  __pyx_v_ii = __pyx_t_24;
9469 
9470  /* "subsurfaceTransportFunctions.pyx":349
9471  * a_neig[ii] = rho*KWs[matID_neig,ii]
9472  * for ii in range(nnz):
9473  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20) # <<<<<<<<<<<<<<
9474  * q_alin[eN,ebN,ii] = a_avg[ii]
9475  * for I in range(nSpace):
9476  */
9477  __pyx_t_33 = __pyx_v_ii;
9478  __pyx_t_26 = -1;
9479  if (__pyx_t_33 < 0) {
9480  __pyx_t_33 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9481  if (unlikely(__pyx_t_33 < 0)) __pyx_t_26 = 0;
9482  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_26 = 0;
9483  if (unlikely(__pyx_t_26 != -1)) {
9484  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9485  __PYX_ERR(0, 349, __pyx_L1_error)
9486  }
9487  __pyx_t_34 = __pyx_v_ii;
9488  __pyx_t_26 = -1;
9489  if (__pyx_t_34 < 0) {
9490  __pyx_t_34 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9491  if (unlikely(__pyx_t_34 < 0)) __pyx_t_26 = 0;
9492  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_26 = 0;
9493  if (unlikely(__pyx_t_26 != -1)) {
9494  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9495  __PYX_ERR(0, 349, __pyx_L1_error)
9496  }
9497  __pyx_t_35 = ((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_a_eN.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_a_neig.diminfo[0].strides)));
9498  __pyx_t_36 = __pyx_v_ii;
9499  __pyx_t_26 = -1;
9500  if (__pyx_t_36 < 0) {
9501  __pyx_t_36 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9502  if (unlikely(__pyx_t_36 < 0)) __pyx_t_26 = 0;
9503  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_26 = 0;
9504  if (unlikely(__pyx_t_26 != -1)) {
9505  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9506  __PYX_ERR(0, 349, __pyx_L1_error)
9507  }
9508  __pyx_t_37 = __pyx_v_ii;
9509  __pyx_t_26 = -1;
9510  if (__pyx_t_37 < 0) {
9511  __pyx_t_37 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9512  if (unlikely(__pyx_t_37 < 0)) __pyx_t_26 = 0;
9513  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_26 = 0;
9514  if (unlikely(__pyx_t_26 != -1)) {
9515  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9516  __PYX_ERR(0, 349, __pyx_L1_error)
9517  }
9518  __pyx_t_38 = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_a_eN.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_a_neig.diminfo[0].strides))) + 1.0e-20);
9519  if (unlikely(__pyx_t_38 == 0)) {
9520  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
9521  __PYX_ERR(0, 349, __pyx_L1_error)
9522  }
9523  __pyx_t_39 = __pyx_v_ii;
9524  __pyx_t_26 = -1;
9525  if (__pyx_t_39 < 0) {
9526  __pyx_t_39 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9527  if (unlikely(__pyx_t_39 < 0)) __pyx_t_26 = 0;
9528  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_26 = 0;
9529  if (unlikely(__pyx_t_26 != -1)) {
9530  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9531  __PYX_ERR(0, 349, __pyx_L1_error)
9532  }
9533  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_a_avg.diminfo[0].strides) = (__pyx_t_35 / __pyx_t_38);
9534 
9535  /* "subsurfaceTransportFunctions.pyx":350
9536  * for ii in range(nnz):
9537  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9538  * q_alin[eN,ebN,ii] = a_avg[ii] # <<<<<<<<<<<<<<
9539  * for I in range(nSpace):
9540  * q_flin[eN,ebN,I] = 0.0
9541  */
9542  __pyx_t_40 = __pyx_v_ii;
9543  __pyx_t_26 = -1;
9544  if (__pyx_t_40 < 0) {
9545  __pyx_t_40 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9546  if (unlikely(__pyx_t_40 < 0)) __pyx_t_26 = 0;
9547  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_26 = 0;
9548  if (unlikely(__pyx_t_26 != -1)) {
9549  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9550  __PYX_ERR(0, 350, __pyx_L1_error)
9551  }
9552  __pyx_t_41 = __pyx_v_eN;
9553  __pyx_t_42 = __pyx_v_ebN;
9554  __pyx_t_43 = __pyx_v_ii;
9555  __pyx_t_26 = -1;
9556  if (__pyx_t_41 < 0) {
9557  __pyx_t_41 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
9558  if (unlikely(__pyx_t_41 < 0)) __pyx_t_26 = 0;
9559  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_26 = 0;
9560  if (__pyx_t_42 < 0) {
9561  __pyx_t_42 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
9562  if (unlikely(__pyx_t_42 < 0)) __pyx_t_26 = 1;
9563  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_26 = 1;
9564  if (__pyx_t_43 < 0) {
9565  __pyx_t_43 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
9566  if (unlikely(__pyx_t_43 < 0)) __pyx_t_26 = 2;
9567  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_26 = 2;
9568  if (unlikely(__pyx_t_26 != -1)) {
9569  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9570  __PYX_ERR(0, 350, __pyx_L1_error)
9571  }
9572  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_43, __pyx_pybuffernd_q_alin.diminfo[2].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_a_avg.diminfo[0].strides));
9573  }
9574 
9575  /* "subsurfaceTransportFunctions.pyx":351
9576  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9577  * q_alin[eN,ebN,ii] = a_avg[ii]
9578  * for I in range(nSpace): # <<<<<<<<<<<<<<
9579  * q_flin[eN,ebN,I] = 0.0
9580  * for ii in range(rowptr[I],rowptr[I+1]):
9581  */
9582  __pyx_t_19 = __pyx_v_nSpace;
9583  __pyx_t_23 = __pyx_t_19;
9584  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
9585  __pyx_v_I = __pyx_t_24;
9586 
9587  /* "subsurfaceTransportFunctions.pyx":352
9588  * q_alin[eN,ebN,ii] = a_avg[ii]
9589  * for I in range(nSpace):
9590  * q_flin[eN,ebN,I] = 0.0 # <<<<<<<<<<<<<<
9591  * for ii in range(rowptr[I],rowptr[I+1]):
9592  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9593  */
9594  __pyx_t_44 = __pyx_v_eN;
9595  __pyx_t_45 = __pyx_v_ebN;
9596  __pyx_t_46 = __pyx_v_I;
9597  __pyx_t_26 = -1;
9598  if (__pyx_t_44 < 0) {
9599  __pyx_t_44 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9600  if (unlikely(__pyx_t_44 < 0)) __pyx_t_26 = 0;
9601  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_26 = 0;
9602  if (__pyx_t_45 < 0) {
9603  __pyx_t_45 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9604  if (unlikely(__pyx_t_45 < 0)) __pyx_t_26 = 1;
9605  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_26 = 1;
9606  if (__pyx_t_46 < 0) {
9607  __pyx_t_46 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9608  if (unlikely(__pyx_t_46 < 0)) __pyx_t_26 = 2;
9609  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_26 = 2;
9610  if (unlikely(__pyx_t_26 != -1)) {
9611  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9612  __PYX_ERR(0, 352, __pyx_L1_error)
9613  }
9614  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_46, __pyx_pybuffernd_q_flin.diminfo[2].strides) = 0.0;
9615 
9616  /* "subsurfaceTransportFunctions.pyx":353
9617  * for I in range(nSpace):
9618  * q_flin[eN,ebN,I] = 0.0
9619  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
9620  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9621  * #ebN
9622  */
9623  __pyx_t_47 = (__pyx_v_I + 1);
9624  __pyx_t_26 = -1;
9625  if (__pyx_t_47 < 0) {
9626  __pyx_t_47 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9627  if (unlikely(__pyx_t_47 < 0)) __pyx_t_26 = 0;
9628  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_26 = 0;
9629  if (unlikely(__pyx_t_26 != -1)) {
9630  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9631  __PYX_ERR(0, 353, __pyx_L1_error)
9632  }
9633  __pyx_t_48 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_rowptr.diminfo[0].strides));
9634  __pyx_t_49 = __pyx_v_I;
9635  __pyx_t_26 = -1;
9636  if (__pyx_t_49 < 0) {
9637  __pyx_t_49 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9638  if (unlikely(__pyx_t_49 < 0)) __pyx_t_26 = 0;
9639  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_26 = 0;
9640  if (unlikely(__pyx_t_26 != -1)) {
9641  __Pyx_RaiseBufferIndexError(__pyx_t_26);
9642  __PYX_ERR(0, 353, __pyx_L1_error)
9643  }
9644  __pyx_t_50 = __pyx_t_48;
9645  for (__pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_26 < __pyx_t_50; __pyx_t_26+=1) {
9646  __pyx_v_ii = __pyx_t_26;
9647 
9648  /* "subsurfaceTransportFunctions.pyx":354
9649  * q_flin[eN,ebN,I] = 0.0
9650  * for ii in range(rowptr[I],rowptr[I+1]):
9651  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]] # <<<<<<<<<<<<<<
9652  * #ebN
9653  * #eN
9654  */
9655  __pyx_t_51 = __pyx_v_ii;
9656  __pyx_t_52 = -1;
9657  if (__pyx_t_51 < 0) {
9658  __pyx_t_51 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9659  if (unlikely(__pyx_t_51 < 0)) __pyx_t_52 = 0;
9660  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_52 = 0;
9661  if (unlikely(__pyx_t_52 != -1)) {
9662  __Pyx_RaiseBufferIndexError(__pyx_t_52);
9663  __PYX_ERR(0, 354, __pyx_L1_error)
9664  }
9665  __pyx_t_53 = __pyx_v_ii;
9666  __pyx_t_52 = -1;
9667  if (__pyx_t_53 < 0) {
9668  __pyx_t_53 += __pyx_pybuffernd_colind.diminfo[0].shape;
9669  if (unlikely(__pyx_t_53 < 0)) __pyx_t_52 = 0;
9670  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_52 = 0;
9671  if (unlikely(__pyx_t_52 != -1)) {
9672  __Pyx_RaiseBufferIndexError(__pyx_t_52);
9673  __PYX_ERR(0, 354, __pyx_L1_error)
9674  }
9675  __pyx_t_54 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_colind.diminfo[0].strides));
9676  __pyx_t_52 = -1;
9677  if (__pyx_t_54 < 0) {
9678  __pyx_t_54 += __pyx_pybuffernd_gravity.diminfo[0].shape;
9679  if (unlikely(__pyx_t_54 < 0)) __pyx_t_52 = 0;
9680  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_gravity.diminfo[0].shape)) __pyx_t_52 = 0;
9681  if (unlikely(__pyx_t_52 != -1)) {
9682  __Pyx_RaiseBufferIndexError(__pyx_t_52);
9683  __PYX_ERR(0, 354, __pyx_L1_error)
9684  }
9685  __pyx_t_55 = __pyx_v_eN;
9686  __pyx_t_56 = __pyx_v_ebN;
9687  __pyx_t_57 = __pyx_v_I;
9688  __pyx_t_52 = -1;
9689  if (__pyx_t_55 < 0) {
9690  __pyx_t_55 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9691  if (unlikely(__pyx_t_55 < 0)) __pyx_t_52 = 0;
9692  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_52 = 0;
9693  if (__pyx_t_56 < 0) {
9694  __pyx_t_56 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9695  if (unlikely(__pyx_t_56 < 0)) __pyx_t_52 = 1;
9696  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_52 = 1;
9697  if (__pyx_t_57 < 0) {
9698  __pyx_t_57 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9699  if (unlikely(__pyx_t_57 < 0)) __pyx_t_52 = 2;
9700  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_52 = 2;
9701  if (unlikely(__pyx_t_52 != -1)) {
9702  __Pyx_RaiseBufferIndexError(__pyx_t_52);
9703  __PYX_ERR(0, 354, __pyx_L1_error)
9704  }
9705  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_57, __pyx_pybuffernd_q_flin.diminfo[2].strides) += ((__pyx_v_rho * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_a_avg.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_gravity.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_gravity.diminfo[0].strides)));
9706  }
9707  }
9708  }
9709  }
9710 
9711  /* "subsurfaceTransportFunctions.pyx":301
9712  *
9713  * ##################################################
9714  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
9715  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9716  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
9717  */
9718 
9719  /* function exit code */
9720  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9721  goto __pyx_L0;
9722  __pyx_L1_error:;
9723  __Pyx_XDECREF(__pyx_t_3);
9724  __Pyx_XDECREF(__pyx_t_4);
9725  __Pyx_XDECREF(__pyx_t_5);
9726  __Pyx_XDECREF(__pyx_t_6);
9727  __Pyx_XDECREF(__pyx_t_7);
9728  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
9729  __Pyx_PyThreadState_declare
9730  __Pyx_PyThreadState_assign
9731  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
9732  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9733  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9734  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9735  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9736  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9737  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9738  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9739  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9740  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9741  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9742  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9743  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
9744  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
9745  __pyx_r = NULL;
9746  goto __pyx_L2;
9747  __pyx_L0:;
9748  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9749  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9750  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9751  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9752  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9753  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9754  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9755  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9756  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9757  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9758  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9759  __pyx_L2:;
9760  __Pyx_XDECREF((PyObject *)__pyx_v_a_eN);
9761  __Pyx_XDECREF((PyObject *)__pyx_v_a_neig);
9762  __Pyx_XDECREF((PyObject *)__pyx_v_a_avg);
9763  __Pyx_XGIVEREF(__pyx_r);
9764  __Pyx_RefNannyFinishContext();
9765  return __pyx_r;
9766 }
9767 
9768 /* "subsurfaceTransportFunctions.pyx":359
9769  *
9770  *
9771  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
9772  * double beta,
9773  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9774  */
9775 
9776 /* Python wrapper */
9777 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9778 static char __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM[] = "\n routine for evaluating nodal coefficients in NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
9779 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM = {"RE_NCP1_evaluateElementCoefficients_VGM", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM};
9780 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9781  double __pyx_v_rho;
9782  double __pyx_v_beta;
9783  PyArrayObject *__pyx_v_gravity = 0;
9784  PyArrayObject *__pyx_v_alpha = 0;
9785  PyArrayObject *__pyx_v_n = 0;
9786  PyArrayObject *__pyx_v_thetaR = 0;
9787  PyArrayObject *__pyx_v_thetaSR = 0;
9788  int __pyx_v_nSpace;
9789  int __pyx_v_nElements_global;
9790  int __pyx_v_nElementBoundaries_element;
9791  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
9792  PyArrayObject *__pyx_v_elementBarycentersArray = 0;
9793  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
9794  int __pyx_v_nDOF_trial_element;
9795  PyArrayObject *__pyx_v_u_l2g = 0;
9796  PyArrayObject *__pyx_v_u_dof = 0;
9797  CYTHON_UNUSED PyArrayObject *__pyx_v_q_x = 0;
9798  PyArrayObject *__pyx_v_q_u = 0;
9799  PyArrayObject *__pyx_v_q_mass = 0;
9800  PyArrayObject *__pyx_v_q_dmass = 0;
9801  PyArrayObject *__pyx_v_q_r = 0;
9802  PyArrayObject *__pyx_v_q_kr = 0;
9803  PyArrayObject *__pyx_v_q_dkr = 0;
9804  PyArrayObject *__pyx_v_q_kr_up = 0;
9805  PyObject *__pyx_r = 0;
9806  __Pyx_RefNannyDeclarations
9807  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM (wrapper)", 0);
9808  {
9809  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_beta,&__pyx_n_s_gravity,&__pyx_n_s_alpha,&__pyx_n_s_n,&__pyx_n_s_thetaR,&__pyx_n_s_thetaSR,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_u_l2g,&__pyx_n_s_u_dof,&__pyx_n_s_q_x,&__pyx_n_s_q_u,&__pyx_n_s_q_mass,&__pyx_n_s_q_dmass,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,0};
9810  PyObject* values[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
9811  if (unlikely(__pyx_kwds)) {
9812  Py_ssize_t kw_args;
9813  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9814  switch (pos_args) {
9815  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
9816  CYTHON_FALLTHROUGH;
9817  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
9818  CYTHON_FALLTHROUGH;
9819  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
9820  CYTHON_FALLTHROUGH;
9821  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
9822  CYTHON_FALLTHROUGH;
9823  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
9824  CYTHON_FALLTHROUGH;
9825  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
9826  CYTHON_FALLTHROUGH;
9827  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
9828  CYTHON_FALLTHROUGH;
9829  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
9830  CYTHON_FALLTHROUGH;
9831  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
9832  CYTHON_FALLTHROUGH;
9833  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
9834  CYTHON_FALLTHROUGH;
9835  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
9836  CYTHON_FALLTHROUGH;
9837  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
9838  CYTHON_FALLTHROUGH;
9839  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
9840  CYTHON_FALLTHROUGH;
9841  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
9842  CYTHON_FALLTHROUGH;
9843  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
9844  CYTHON_FALLTHROUGH;
9845  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
9846  CYTHON_FALLTHROUGH;
9847  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
9848  CYTHON_FALLTHROUGH;
9849  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
9850  CYTHON_FALLTHROUGH;
9851  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
9852  CYTHON_FALLTHROUGH;
9853  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9854  CYTHON_FALLTHROUGH;
9855  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9856  CYTHON_FALLTHROUGH;
9857  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9858  CYTHON_FALLTHROUGH;
9859  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9860  CYTHON_FALLTHROUGH;
9861  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9862  CYTHON_FALLTHROUGH;
9863  case 0: break;
9864  default: goto __pyx_L5_argtuple_error;
9865  }
9866  kw_args = PyDict_Size(__pyx_kwds);
9867  switch (pos_args) {
9868  case 0:
9869  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
9870  else goto __pyx_L5_argtuple_error;
9871  CYTHON_FALLTHROUGH;
9872  case 1:
9873  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
9874  else {
9875  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 1); __PYX_ERR(0, 359, __pyx_L3_error)
9876  }
9877  CYTHON_FALLTHROUGH;
9878  case 2:
9879  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
9880  else {
9881  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 2); __PYX_ERR(0, 359, __pyx_L3_error)
9882  }
9883  CYTHON_FALLTHROUGH;
9884  case 3:
9885  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
9886  else {
9887  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 3); __PYX_ERR(0, 359, __pyx_L3_error)
9888  }
9889  CYTHON_FALLTHROUGH;
9890  case 4:
9891  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
9892  else {
9893  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 4); __PYX_ERR(0, 359, __pyx_L3_error)
9894  }
9895  CYTHON_FALLTHROUGH;
9896  case 5:
9897  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thetaR)) != 0)) kw_args--;
9898  else {
9899  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 5); __PYX_ERR(0, 359, __pyx_L3_error)
9900  }
9901  CYTHON_FALLTHROUGH;
9902  case 6:
9903  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thetaSR)) != 0)) kw_args--;
9904  else {
9905  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 6); __PYX_ERR(0, 359, __pyx_L3_error)
9906  }
9907  CYTHON_FALLTHROUGH;
9908  case 7:
9909  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
9910  else {
9911  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 7); __PYX_ERR(0, 359, __pyx_L3_error)
9912  }
9913  CYTHON_FALLTHROUGH;
9914  case 8:
9915  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
9916  else {
9917  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 8); __PYX_ERR(0, 359, __pyx_L3_error)
9918  }
9919  CYTHON_FALLTHROUGH;
9920  case 9:
9921  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
9922  else {
9923  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 9); __PYX_ERR(0, 359, __pyx_L3_error)
9924  }
9925  CYTHON_FALLTHROUGH;
9926  case 10:
9927  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
9928  else {
9929  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 10); __PYX_ERR(0, 359, __pyx_L3_error)
9930  }
9931  CYTHON_FALLTHROUGH;
9932  case 11:
9933  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
9934  else {
9935  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 11); __PYX_ERR(0, 359, __pyx_L3_error)
9936  }
9937  CYTHON_FALLTHROUGH;
9938  case 12:
9939  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
9940  else {
9941  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 12); __PYX_ERR(0, 359, __pyx_L3_error)
9942  }
9943  CYTHON_FALLTHROUGH;
9944  case 13:
9945  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
9946  else {
9947  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 13); __PYX_ERR(0, 359, __pyx_L3_error)
9948  }
9949  CYTHON_FALLTHROUGH;
9950  case 14:
9951  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u_l2g)) != 0)) kw_args--;
9952  else {
9953  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 14); __PYX_ERR(0, 359, __pyx_L3_error)
9954  }
9955  CYTHON_FALLTHROUGH;
9956  case 15:
9957  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u_dof)) != 0)) kw_args--;
9958  else {
9959  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 15); __PYX_ERR(0, 359, __pyx_L3_error)
9960  }
9961  CYTHON_FALLTHROUGH;
9962  case 16:
9963  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_x)) != 0)) kw_args--;
9964  else {
9965  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 16); __PYX_ERR(0, 359, __pyx_L3_error)
9966  }
9967  CYTHON_FALLTHROUGH;
9968  case 17:
9969  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
9970  else {
9971  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 17); __PYX_ERR(0, 359, __pyx_L3_error)
9972  }
9973  CYTHON_FALLTHROUGH;
9974  case 18:
9975  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mass)) != 0)) kw_args--;
9976  else {
9977  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 18); __PYX_ERR(0, 359, __pyx_L3_error)
9978  }
9979  CYTHON_FALLTHROUGH;
9980  case 19:
9981  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dmass)) != 0)) kw_args--;
9982  else {
9983  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 19); __PYX_ERR(0, 359, __pyx_L3_error)
9984  }
9985  CYTHON_FALLTHROUGH;
9986  case 20:
9987  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
9988  else {
9989  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 20); __PYX_ERR(0, 359, __pyx_L3_error)
9990  }
9991  CYTHON_FALLTHROUGH;
9992  case 21:
9993  if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
9994  else {
9995  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 21); __PYX_ERR(0, 359, __pyx_L3_error)
9996  }
9997  CYTHON_FALLTHROUGH;
9998  case 22:
9999  if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
10000  else {
10001  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 22); __PYX_ERR(0, 359, __pyx_L3_error)
10002  }
10003  CYTHON_FALLTHROUGH;
10004  case 23:
10005  if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
10006  else {
10007  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 23); __PYX_ERR(0, 359, __pyx_L3_error)
10008  }
10009  }
10010  if (unlikely(kw_args > 0)) {
10011  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_VGM") < 0)) __PYX_ERR(0, 359, __pyx_L3_error)
10012  }
10013  } else if (PyTuple_GET_SIZE(__pyx_args) != 24) {
10014  goto __pyx_L5_argtuple_error;
10015  } else {
10016  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10017  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10018  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10019  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10020  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10021  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
10022  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
10023  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
10024  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
10025  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
10026  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
10027  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
10028  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
10029  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
10030  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
10031  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
10032  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
10033  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
10034  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
10035  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
10036  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
10037  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
10038  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
10039  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
10040  }
10041  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error)
10042  __pyx_v_beta = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 360, __pyx_L3_error)
10043  __pyx_v_gravity = ((PyArrayObject *)values[2]);
10044  __pyx_v_alpha = ((PyArrayObject *)values[3]);
10045  __pyx_v_n = ((PyArrayObject *)values[4]);
10046  __pyx_v_thetaR = ((PyArrayObject *)values[5]);
10047  __pyx_v_thetaSR = ((PyArrayObject *)values[6]);
10048  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L3_error)
10049  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L3_error)
10050  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error)
10051  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[10]);
10052  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[11]);
10053  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[12]);
10054  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[13]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L3_error)
10055  __pyx_v_u_l2g = ((PyArrayObject *)values[14]);
10056  __pyx_v_u_dof = ((PyArrayObject *)values[15]);
10057  __pyx_v_q_x = ((PyArrayObject *)values[16]);
10058  __pyx_v_q_u = ((PyArrayObject *)values[17]);
10059  __pyx_v_q_mass = ((PyArrayObject *)values[18]);
10060  __pyx_v_q_dmass = ((PyArrayObject *)values[19]);
10061  __pyx_v_q_r = ((PyArrayObject *)values[20]);
10062  __pyx_v_q_kr = ((PyArrayObject *)values[21]);
10063  __pyx_v_q_dkr = ((PyArrayObject *)values[22]);
10064  __pyx_v_q_kr_up = ((PyArrayObject *)values[23]);
10065  }
10066  goto __pyx_L4_argument_unpacking_done;
10067  __pyx_L5_argtuple_error:;
10068  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 359, __pyx_L3_error)
10069  __pyx_L3_error:;
10070  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
10071  __Pyx_RefNannyFinishContext();
10072  return NULL;
10073  __pyx_L4_argument_unpacking_done:;
10074  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 361, __pyx_L1_error)
10075  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alpha), __pyx_ptype_5numpy_ndarray, 1, "alpha", 0))) __PYX_ERR(0, 362, __pyx_L1_error)
10076  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 363, __pyx_L1_error)
10077  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaR), __pyx_ptype_5numpy_ndarray, 1, "thetaR", 0))) __PYX_ERR(0, 364, __pyx_L1_error)
10078  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaSR), __pyx_ptype_5numpy_ndarray, 1, "thetaSR", 0))) __PYX_ERR(0, 365, __pyx_L1_error)
10079  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 370, __pyx_L1_error)
10080  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 371, __pyx_L1_error)
10081  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 372, __pyx_L1_error)
10082  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_l2g), __pyx_ptype_5numpy_ndarray, 1, "u_l2g", 0))) __PYX_ERR(0, 375, __pyx_L1_error)
10083  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_dof), __pyx_ptype_5numpy_ndarray, 1, "u_dof", 0))) __PYX_ERR(0, 376, __pyx_L1_error)
10084  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_x), __pyx_ptype_5numpy_ndarray, 1, "q_x", 0))) __PYX_ERR(0, 378, __pyx_L1_error)
10085  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 379, __pyx_L1_error)
10086  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mass), __pyx_ptype_5numpy_ndarray, 1, "q_mass", 0))) __PYX_ERR(0, 380, __pyx_L1_error)
10087  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmass), __pyx_ptype_5numpy_ndarray, 1, "q_dmass", 0))) __PYX_ERR(0, 381, __pyx_L1_error)
10088  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 382, __pyx_L1_error)
10089  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 383, __pyx_L1_error)
10090  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 384, __pyx_L1_error)
10091  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 385, __pyx_L1_error)
10092  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(__pyx_self, __pyx_v_rho, __pyx_v_beta, __pyx_v_gravity, __pyx_v_alpha, __pyx_v_n, __pyx_v_thetaR, __pyx_v_thetaSR, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_elementMaterialTypes, __pyx_v_nDOF_trial_element, __pyx_v_u_l2g, __pyx_v_u_dof, __pyx_v_q_x, __pyx_v_q_u, __pyx_v_q_mass, __pyx_v_q_dmass, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up);
10093 
10094  /* function exit code */
10095  goto __pyx_L0;
10096  __pyx_L1_error:;
10097  __pyx_r = NULL;
10098  __pyx_L0:;
10099  __Pyx_RefNannyFinishContext();
10100  return __pyx_r;
10101 }
10102 
10103 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up) {
10104  PyObject *__pyx_v_q = NULL;
10105  double __pyx_v_psiC;
10106  double __pyx_v_pcBar;
10107  double __pyx_v_pcBar_n;
10108  double __pyx_v_pcBar_nM1;
10109  double __pyx_v_pcBar_nM2;
10110  double __pyx_v_onePlus_pcBar_n;
10111  double __pyx_v_sBar;
10112  double __pyx_v_sqrt_sBar;
10113  double __pyx_v_DsBar_DpsiC;
10114  double __pyx_v_thetaW;
10115  double __pyx_v_DthetaW_DpsiC;
10116  double __pyx_v_vBar;
10117  double __pyx_v_vBar2;
10118  double __pyx_v_DvBar_DpsiC;
10119  double __pyx_v_KWr;
10120  double __pyx_v_DKWr_DpsiC;
10121  CYTHON_UNUSED double __pyx_v_rho2;
10122  double __pyx_v_thetaS;
10123  double __pyx_v_rhom;
10124  double __pyx_v_drhom;
10125  double __pyx_v_m;
10126  double __pyx_v_u_j;
10127  double __pyx_v_u_eN;
10128  double __pyx_v_u_neig;
10129  double __pyx_v_kr_eN;
10130  double __pyx_v_kr_neig;
10131  double __pyx_v_phi_eN;
10132  double __pyx_v_phi_neig;
10133  int __pyx_v_eN;
10134  int __pyx_v_eN_neighbor;
10135  int __pyx_v_ebN;
10136  int __pyx_v_j;
10137  int __pyx_v_matID;
10138  double __pyx_v_nAvgWeight;
10139  __Pyx_LocalBuf_ND __pyx_pybuffernd_alpha;
10140  __Pyx_Buffer __pyx_pybuffer_alpha;
10141  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
10142  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
10143  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
10144  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
10145  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
10146  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
10147  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
10148  __Pyx_Buffer __pyx_pybuffer_gravity;
10149  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
10150  __Pyx_Buffer __pyx_pybuffer_n;
10151  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
10152  __Pyx_Buffer __pyx_pybuffer_q_dkr;
10153  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmass;
10154  __Pyx_Buffer __pyx_pybuffer_q_dmass;
10155  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
10156  __Pyx_Buffer __pyx_pybuffer_q_kr;
10157  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
10158  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
10159  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mass;
10160  __Pyx_Buffer __pyx_pybuffer_q_mass;
10161  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
10162  __Pyx_Buffer __pyx_pybuffer_q_r;
10163  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
10164  __Pyx_Buffer __pyx_pybuffer_q_u;
10165  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_x;
10166  __Pyx_Buffer __pyx_pybuffer_q_x;
10167  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaR;
10168  __Pyx_Buffer __pyx_pybuffer_thetaR;
10169  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaSR;
10170  __Pyx_Buffer __pyx_pybuffer_thetaSR;
10171  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_dof;
10172  __Pyx_Buffer __pyx_pybuffer_u_dof;
10173  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_l2g;
10174  __Pyx_Buffer __pyx_pybuffer_u_l2g;
10175  PyObject *__pyx_r = NULL;
10176  __Pyx_RefNannyDeclarations
10177  PyObject *__pyx_t_1 = NULL;
10178  PyObject *__pyx_t_2 = NULL;
10179  Py_ssize_t __pyx_t_3;
10180  PyObject *__pyx_t_4 = NULL;
10181  PyObject *__pyx_t_5 = NULL;
10182  int __pyx_t_6;
10183  double __pyx_t_7;
10184  int __pyx_t_8;
10185  int __pyx_t_9;
10186  int __pyx_t_10;
10187  Py_ssize_t __pyx_t_11;
10188  int __pyx_t_12;
10189  int __pyx_t_13;
10190  int __pyx_t_14;
10191  Py_ssize_t __pyx_t_15;
10192  Py_ssize_t __pyx_t_16;
10193  int __pyx_t_17;
10194  Py_ssize_t __pyx_t_18;
10195  Py_ssize_t __pyx_t_19;
10196  Py_ssize_t __pyx_t_20;
10197  Py_ssize_t __pyx_t_21;
10198  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_22;
10199  Py_ssize_t __pyx_t_23;
10200  Py_ssize_t __pyx_t_24;
10201  Py_ssize_t __pyx_t_25;
10202  Py_ssize_t __pyx_t_26;
10203  Py_ssize_t __pyx_t_27;
10204  Py_ssize_t __pyx_t_28;
10205  Py_ssize_t __pyx_t_29;
10206  Py_ssize_t __pyx_t_30;
10207  Py_ssize_t __pyx_t_31;
10208  Py_ssize_t __pyx_t_32;
10209  Py_ssize_t __pyx_t_33;
10210  Py_ssize_t __pyx_t_34;
10211  Py_ssize_t __pyx_t_35;
10212  Py_ssize_t __pyx_t_36;
10213  Py_ssize_t __pyx_t_37;
10214  Py_ssize_t __pyx_t_38;
10215  Py_ssize_t __pyx_t_39;
10216  Py_ssize_t __pyx_t_40;
10217  Py_ssize_t __pyx_t_41;
10218  PyObject *__pyx_t_42 = NULL;
10219  PyObject *__pyx_t_43 = NULL;
10220  Py_ssize_t __pyx_t_44;
10221  Py_ssize_t __pyx_t_45;
10222  Py_ssize_t __pyx_t_46;
10223  Py_ssize_t __pyx_t_47;
10224  Py_ssize_t __pyx_t_48;
10225  Py_ssize_t __pyx_t_49;
10226  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM", 0);
10227  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
10228  __pyx_pybuffer_gravity.refcount = 0;
10229  __pyx_pybuffernd_gravity.data = NULL;
10230  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
10231  __pyx_pybuffer_alpha.pybuffer.buf = NULL;
10232  __pyx_pybuffer_alpha.refcount = 0;
10233  __pyx_pybuffernd_alpha.data = NULL;
10234  __pyx_pybuffernd_alpha.rcbuffer = &__pyx_pybuffer_alpha;
10235  __pyx_pybuffer_n.pybuffer.buf = NULL;
10236  __pyx_pybuffer_n.refcount = 0;
10237  __pyx_pybuffernd_n.data = NULL;
10238  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
10239  __pyx_pybuffer_thetaR.pybuffer.buf = NULL;
10240  __pyx_pybuffer_thetaR.refcount = 0;
10241  __pyx_pybuffernd_thetaR.data = NULL;
10242  __pyx_pybuffernd_thetaR.rcbuffer = &__pyx_pybuffer_thetaR;
10243  __pyx_pybuffer_thetaSR.pybuffer.buf = NULL;
10244  __pyx_pybuffer_thetaSR.refcount = 0;
10245  __pyx_pybuffernd_thetaSR.data = NULL;
10246  __pyx_pybuffernd_thetaSR.rcbuffer = &__pyx_pybuffer_thetaSR;
10247  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
10248  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
10249  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
10250  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
10251  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
10252  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
10253  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
10254  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
10255  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
10256  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
10257  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
10258  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
10259  __pyx_pybuffer_u_l2g.pybuffer.buf = NULL;
10260  __pyx_pybuffer_u_l2g.refcount = 0;
10261  __pyx_pybuffernd_u_l2g.data = NULL;
10262  __pyx_pybuffernd_u_l2g.rcbuffer = &__pyx_pybuffer_u_l2g;
10263  __pyx_pybuffer_u_dof.pybuffer.buf = NULL;
10264  __pyx_pybuffer_u_dof.refcount = 0;
10265  __pyx_pybuffernd_u_dof.data = NULL;
10266  __pyx_pybuffernd_u_dof.rcbuffer = &__pyx_pybuffer_u_dof;
10267  __pyx_pybuffer_q_x.pybuffer.buf = NULL;
10268  __pyx_pybuffer_q_x.refcount = 0;
10269  __pyx_pybuffernd_q_x.data = NULL;
10270  __pyx_pybuffernd_q_x.rcbuffer = &__pyx_pybuffer_q_x;
10271  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
10272  __pyx_pybuffer_q_u.refcount = 0;
10273  __pyx_pybuffernd_q_u.data = NULL;
10274  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
10275  __pyx_pybuffer_q_mass.pybuffer.buf = NULL;
10276  __pyx_pybuffer_q_mass.refcount = 0;
10277  __pyx_pybuffernd_q_mass.data = NULL;
10278  __pyx_pybuffernd_q_mass.rcbuffer = &__pyx_pybuffer_q_mass;
10279  __pyx_pybuffer_q_dmass.pybuffer.buf = NULL;
10280  __pyx_pybuffer_q_dmass.refcount = 0;
10281  __pyx_pybuffernd_q_dmass.data = NULL;
10282  __pyx_pybuffernd_q_dmass.rcbuffer = &__pyx_pybuffer_q_dmass;
10283  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
10284  __pyx_pybuffer_q_r.refcount = 0;
10285  __pyx_pybuffernd_q_r.data = NULL;
10286  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
10287  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
10288  __pyx_pybuffer_q_kr.refcount = 0;
10289  __pyx_pybuffernd_q_kr.data = NULL;
10290  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
10291  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
10292  __pyx_pybuffer_q_dkr.refcount = 0;
10293  __pyx_pybuffernd_q_dkr.data = NULL;
10294  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
10295  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
10296  __pyx_pybuffer_q_kr_up.refcount = 0;
10297  __pyx_pybuffernd_q_kr_up.data = NULL;
10298  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
10299  {
10300  __Pyx_BufFmt_StackElem __pyx_stack[1];
10301  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10302  }
10303  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
10304  {
10305  __Pyx_BufFmt_StackElem __pyx_stack[1];
10306  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer, (PyObject*)__pyx_v_alpha, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10307  }
10308  __pyx_pybuffernd_alpha.diminfo[0].strides = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alpha.diminfo[0].shape = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.shape[0];
10309  {
10310  __Pyx_BufFmt_StackElem __pyx_stack[1];
10311  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10312  }
10313  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0];
10314  {
10315  __Pyx_BufFmt_StackElem __pyx_stack[1];
10316  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10317  }
10318  __pyx_pybuffernd_thetaR.diminfo[0].strides = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaR.diminfo[0].shape = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.shape[0];
10319  {
10320  __Pyx_BufFmt_StackElem __pyx_stack[1];
10321  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaSR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10322  }
10323  __pyx_pybuffernd_thetaSR.diminfo[0].strides = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaSR.diminfo[0].shape = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.shape[0];
10324  {
10325  __Pyx_BufFmt_StackElem __pyx_stack[1];
10326  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10327  }
10328  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
10329  {
10330  __Pyx_BufFmt_StackElem __pyx_stack[1];
10331  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10332  }
10333  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
10334  {
10335  __Pyx_BufFmt_StackElem __pyx_stack[1];
10336  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10337  }
10338  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
10339  {
10340  __Pyx_BufFmt_StackElem __pyx_stack[1];
10341  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10342  }
10343  __pyx_pybuffernd_u_l2g.diminfo[0].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_l2g.diminfo[0].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_u_l2g.diminfo[1].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_u_l2g.diminfo[1].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[1];
10344  {
10345  __Pyx_BufFmt_StackElem __pyx_stack[1];
10346  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_dof, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10347  }
10348  __pyx_pybuffernd_u_dof.diminfo[0].strides = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_dof.diminfo[0].shape = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.shape[0];
10349  {
10350  __Pyx_BufFmt_StackElem __pyx_stack[1];
10351  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10352  }
10353  __pyx_pybuffernd_q_x.diminfo[0].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_x.diminfo[0].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_x.diminfo[1].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_x.diminfo[1].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_x.diminfo[2].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_x.diminfo[2].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[2];
10354  {
10355  __Pyx_BufFmt_StackElem __pyx_stack[1];
10356  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10357  }
10358  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
10359  {
10360  __Pyx_BufFmt_StackElem __pyx_stack[1];
10361  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10362  }
10363  __pyx_pybuffernd_q_mass.diminfo[0].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mass.diminfo[0].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mass.diminfo[1].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mass.diminfo[1].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[1];
10364  {
10365  __Pyx_BufFmt_StackElem __pyx_stack[1];
10366  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10367  }
10368  __pyx_pybuffernd_q_dmass.diminfo[0].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmass.diminfo[0].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmass.diminfo[1].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmass.diminfo[1].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[1];
10369  {
10370  __Pyx_BufFmt_StackElem __pyx_stack[1];
10371  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10372  }
10373  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
10374  {
10375  __Pyx_BufFmt_StackElem __pyx_stack[1];
10376  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10377  }
10378  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
10379  {
10380  __Pyx_BufFmt_StackElem __pyx_stack[1];
10381  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10382  }
10383  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
10384  {
10385  __Pyx_BufFmt_StackElem __pyx_stack[1];
10386  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10387  }
10388  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
10389 
10390  /* "subsurfaceTransportFunctions.pyx":399
10391  * """
10392  * #check some sizes
10393  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
10394  * assert q.shape[1] == nSpace+1
10395  * assert nDOF_trial_element == nSpace + 1
10396  */
10397  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
10398  __Pyx_GOTREF(__pyx_t_1);
10399  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
10400  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
10401  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
10402  __Pyx_INCREF(((PyObject *)__pyx_v_q_mass));
10403  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mass));
10404  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_mass));
10405  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
10406  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
10407  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_r));
10408  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
10409  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
10410  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_kr));
10411  __Pyx_INCREF(((PyObject *)__pyx_v_q_dkr));
10412  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_dkr));
10413  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_dkr));
10414  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
10415  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10416  for (;;) {
10417  if (__pyx_t_3 >= 5) break;
10418  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10419  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
10420  #else
10421  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
10422  __Pyx_GOTREF(__pyx_t_1);
10423  #endif
10424  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
10425  __pyx_t_1 = 0;
10426 
10427  /* "subsurfaceTransportFunctions.pyx":400
10428  * #check some sizes
10429  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
10430  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
10431  * assert nDOF_trial_element == nSpace + 1
10432  * #temporaries
10433  */
10434  #ifndef CYTHON_WITHOUT_ASSERTIONS
10435  if (unlikely(!Py_OptimizeFlag)) {
10436  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
10437  __Pyx_GOTREF(__pyx_t_1);
10438  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
10439  __Pyx_GOTREF(__pyx_t_4);
10440  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10441  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
10442  __Pyx_GOTREF(__pyx_t_1);
10443  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 400, __pyx_L1_error)
10444  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10445  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10446  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 400, __pyx_L1_error)
10447  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10448  if (unlikely(!__pyx_t_6)) {
10449  PyErr_SetNone(PyExc_AssertionError);
10450  __PYX_ERR(0, 400, __pyx_L1_error)
10451  }
10452  }
10453  #endif
10454 
10455  /* "subsurfaceTransportFunctions.pyx":399
10456  * """
10457  * #check some sizes
10458  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
10459  * assert q.shape[1] == nSpace+1
10460  * assert nDOF_trial_element == nSpace + 1
10461  */
10462  }
10463  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10464 
10465  /* "subsurfaceTransportFunctions.pyx":401
10466  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
10467  * assert q.shape[1] == nSpace+1
10468  * assert nDOF_trial_element == nSpace + 1 # <<<<<<<<<<<<<<
10469  * #temporaries
10470  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10471  */
10472  #ifndef CYTHON_WITHOUT_ASSERTIONS
10473  if (unlikely(!Py_OptimizeFlag)) {
10474  if (unlikely(!((__pyx_v_nDOF_trial_element == (__pyx_v_nSpace + 1)) != 0))) {
10475  PyErr_SetNone(PyExc_AssertionError);
10476  __PYX_ERR(0, 401, __pyx_L1_error)
10477  }
10478  }
10479  #endif
10480 
10481  /* "subsurfaceTransportFunctions.pyx":404
10482  * #temporaries
10483  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10484  * cdef double vBar,vBar2,DvBar_DpsiC,KWr,DKWr_DpsiC,rho2=rho*rho,thetaS,rhom,drhom,m # <<<<<<<<<<<<<<
10485  *
10486  * cdef double u_j,u_eN,u_neig,kr_eN,kr_neig,phi_eN,phi_neig
10487  */
10488  __pyx_v_rho2 = (__pyx_v_rho * __pyx_v_rho);
10489 
10490  /* "subsurfaceTransportFunctions.pyx":409
10491  * cdef int eN,eN_neighbor,ebN,ii,I,j,matID
10492  * #for averaging/integration weights
10493  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
10494  *
10495  * #loop through and evaluate
10496  */
10497  __pyx_t_7 = (__pyx_v_nSpace + 1.);
10498  if (unlikely(__pyx_t_7 == 0)) {
10499  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10500  __PYX_ERR(0, 409, __pyx_L1_error)
10501  }
10502  __pyx_v_nAvgWeight = (1.0 / __pyx_t_7);
10503 
10504  /* "subsurfaceTransportFunctions.pyx":412
10505  *
10506  * #loop through and evaluate
10507  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
10508  * matID = elementMaterialTypes[eN]
10509  * for j in range(nDOF_trial_element):
10510  */
10511  __pyx_t_8 = __pyx_v_nElements_global;
10512  __pyx_t_9 = __pyx_t_8;
10513  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
10514  __pyx_v_eN = __pyx_t_10;
10515 
10516  /* "subsurfaceTransportFunctions.pyx":413
10517  * #loop through and evaluate
10518  * for eN in range(nElements_global):
10519  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
10520  * for j in range(nDOF_trial_element):
10521  * u_j = u_dof[u_l2g[eN,j]]
10522  */
10523  __pyx_t_11 = __pyx_v_eN;
10524  __pyx_t_12 = -1;
10525  if (__pyx_t_11 < 0) {
10526  __pyx_t_11 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
10527  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
10528  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_12 = 0;
10529  if (unlikely(__pyx_t_12 != -1)) {
10530  __Pyx_RaiseBufferIndexError(__pyx_t_12);
10531  __PYX_ERR(0, 413, __pyx_L1_error)
10532  }
10533  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
10534 
10535  /* "subsurfaceTransportFunctions.pyx":414
10536  * for eN in range(nElements_global):
10537  * matID = elementMaterialTypes[eN]
10538  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
10539  * u_j = u_dof[u_l2g[eN,j]]
10540  * q_u[eN,j] = u_j
10541  */
10542  __pyx_t_12 = __pyx_v_nDOF_trial_element;
10543  __pyx_t_13 = __pyx_t_12;
10544  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
10545  __pyx_v_j = __pyx_t_14;
10546 
10547  /* "subsurfaceTransportFunctions.pyx":415
10548  * matID = elementMaterialTypes[eN]
10549  * for j in range(nDOF_trial_element):
10550  * u_j = u_dof[u_l2g[eN,j]] # <<<<<<<<<<<<<<
10551  * q_u[eN,j] = u_j
10552  *
10553  */
10554  __pyx_t_15 = __pyx_v_eN;
10555  __pyx_t_16 = __pyx_v_j;
10556  __pyx_t_17 = -1;
10557  if (__pyx_t_15 < 0) {
10558  __pyx_t_15 += __pyx_pybuffernd_u_l2g.diminfo[0].shape;
10559  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0;
10560  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_u_l2g.diminfo[0].shape)) __pyx_t_17 = 0;
10561  if (__pyx_t_16 < 0) {
10562  __pyx_t_16 += __pyx_pybuffernd_u_l2g.diminfo[1].shape;
10563  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
10564  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_u_l2g.diminfo[1].shape)) __pyx_t_17 = 1;
10565  if (unlikely(__pyx_t_17 != -1)) {
10566  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10567  __PYX_ERR(0, 415, __pyx_L1_error)
10568  }
10569  __pyx_t_18 = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_u_l2g.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_u_l2g.diminfo[1].strides));
10570  __pyx_t_17 = -1;
10571  if (__pyx_t_18 < 0) {
10572  __pyx_t_18 += __pyx_pybuffernd_u_dof.diminfo[0].shape;
10573  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
10574  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_u_dof.diminfo[0].shape)) __pyx_t_17 = 0;
10575  if (unlikely(__pyx_t_17 != -1)) {
10576  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10577  __PYX_ERR(0, 415, __pyx_L1_error)
10578  }
10579  __pyx_v_u_j = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_u_dof.diminfo[0].strides));
10580 
10581  /* "subsurfaceTransportFunctions.pyx":416
10582  * for j in range(nDOF_trial_element):
10583  * u_j = u_dof[u_l2g[eN,j]]
10584  * q_u[eN,j] = u_j # <<<<<<<<<<<<<<
10585  *
10586  * #VGM evaluation
10587  */
10588  __pyx_t_19 = __pyx_v_eN;
10589  __pyx_t_20 = __pyx_v_j;
10590  __pyx_t_17 = -1;
10591  if (__pyx_t_19 < 0) {
10592  __pyx_t_19 += __pyx_pybuffernd_q_u.diminfo[0].shape;
10593  if (unlikely(__pyx_t_19 < 0)) __pyx_t_17 = 0;
10594  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_q_u.diminfo[0].shape)) __pyx_t_17 = 0;
10595  if (__pyx_t_20 < 0) {
10596  __pyx_t_20 += __pyx_pybuffernd_q_u.diminfo[1].shape;
10597  if (unlikely(__pyx_t_20 < 0)) __pyx_t_17 = 1;
10598  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_u.diminfo[1].shape)) __pyx_t_17 = 1;
10599  if (unlikely(__pyx_t_17 != -1)) {
10600  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10601  __PYX_ERR(0, 416, __pyx_L1_error)
10602  }
10603  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_u.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_q_u.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_q_u.diminfo[1].strides) = __pyx_v_u_j;
10604 
10605  /* "subsurfaceTransportFunctions.pyx":419
10606  *
10607  * #VGM evaluation
10608  * psiC = -u_j # <<<<<<<<<<<<<<
10609  * m = 1.0 - 1.0/n[matID]
10610  * thetaS = thetaR[matID] + thetaSR[matID]
10611  */
10612  __pyx_v_psiC = (-__pyx_v_u_j);
10613 
10614  /* "subsurfaceTransportFunctions.pyx":420
10615  * #VGM evaluation
10616  * psiC = -u_j
10617  * m = 1.0 - 1.0/n[matID] # <<<<<<<<<<<<<<
10618  * thetaS = thetaR[matID] + thetaSR[matID]
10619  * if psiC > 0.0:
10620  */
10621  __pyx_t_21 = __pyx_v_matID;
10622  __pyx_t_17 = -1;
10623  if (__pyx_t_21 < 0) {
10624  __pyx_t_21 += __pyx_pybuffernd_n.diminfo[0].shape;
10625  if (unlikely(__pyx_t_21 < 0)) __pyx_t_17 = 0;
10626  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
10627  if (unlikely(__pyx_t_17 != -1)) {
10628  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10629  __PYX_ERR(0, 420, __pyx_L1_error)
10630  }
10631  __pyx_t_22 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_n.diminfo[0].strides));
10632  if (unlikely(__pyx_t_22 == 0)) {
10633  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10634  __PYX_ERR(0, 420, __pyx_L1_error)
10635  }
10636  __pyx_v_m = (1.0 - (1.0 / __pyx_t_22));
10637 
10638  /* "subsurfaceTransportFunctions.pyx":421
10639  * psiC = -u_j
10640  * m = 1.0 - 1.0/n[matID]
10641  * thetaS = thetaR[matID] + thetaSR[matID] # <<<<<<<<<<<<<<
10642  * if psiC > 0.0:
10643  * pcBar = alpha[matID]*psiC
10644  */
10645  __pyx_t_23 = __pyx_v_matID;
10646  __pyx_t_17 = -1;
10647  if (__pyx_t_23 < 0) {
10648  __pyx_t_23 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
10649  if (unlikely(__pyx_t_23 < 0)) __pyx_t_17 = 0;
10650  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_17 = 0;
10651  if (unlikely(__pyx_t_17 != -1)) {
10652  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10653  __PYX_ERR(0, 421, __pyx_L1_error)
10654  }
10655  __pyx_t_24 = __pyx_v_matID;
10656  __pyx_t_17 = -1;
10657  if (__pyx_t_24 < 0) {
10658  __pyx_t_24 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10659  if (unlikely(__pyx_t_24 < 0)) __pyx_t_17 = 0;
10660  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_17 = 0;
10661  if (unlikely(__pyx_t_17 != -1)) {
10662  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10663  __PYX_ERR(0, 421, __pyx_L1_error)
10664  }
10665  __pyx_v_thetaS = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_thetaR.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_thetaSR.diminfo[0].strides)));
10666 
10667  /* "subsurfaceTransportFunctions.pyx":422
10668  * m = 1.0 - 1.0/n[matID]
10669  * thetaS = thetaR[matID] + thetaSR[matID]
10670  * if psiC > 0.0: # <<<<<<<<<<<<<<
10671  * pcBar = alpha[matID]*psiC
10672  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10673  */
10674  __pyx_t_6 = ((__pyx_v_psiC > 0.0) != 0);
10675  if (__pyx_t_6) {
10676 
10677  /* "subsurfaceTransportFunctions.pyx":423
10678  * thetaS = thetaR[matID] + thetaSR[matID]
10679  * if psiC > 0.0:
10680  * pcBar = alpha[matID]*psiC # <<<<<<<<<<<<<<
10681  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10682  * pcBar_nM1 = pcBar_nM2*pcBar
10683  */
10684  __pyx_t_25 = __pyx_v_matID;
10685  __pyx_t_17 = -1;
10686  if (__pyx_t_25 < 0) {
10687  __pyx_t_25 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10688  if (unlikely(__pyx_t_25 < 0)) __pyx_t_17 = 0;
10689  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_17 = 0;
10690  if (unlikely(__pyx_t_17 != -1)) {
10691  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10692  __PYX_ERR(0, 423, __pyx_L1_error)
10693  }
10694  __pyx_v_pcBar = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_alpha.diminfo[0].strides)) * __pyx_v_psiC);
10695 
10696  /* "subsurfaceTransportFunctions.pyx":424
10697  * if psiC > 0.0:
10698  * pcBar = alpha[matID]*psiC
10699  * pcBar_nM2 = pow(pcBar,n[matID]-2) # <<<<<<<<<<<<<<
10700  * pcBar_nM1 = pcBar_nM2*pcBar
10701  * pcBar_n = pcBar_nM1*pcBar
10702  */
10703  __pyx_t_26 = __pyx_v_matID;
10704  __pyx_t_17 = -1;
10705  if (__pyx_t_26 < 0) {
10706  __pyx_t_26 += __pyx_pybuffernd_n.diminfo[0].shape;
10707  if (unlikely(__pyx_t_26 < 0)) __pyx_t_17 = 0;
10708  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
10709  if (unlikely(__pyx_t_17 != -1)) {
10710  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10711  __PYX_ERR(0, 424, __pyx_L1_error)
10712  }
10713  __pyx_v_pcBar_nM2 = pow(__pyx_v_pcBar, ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_n.diminfo[0].strides)) - 2.0));
10714 
10715  /* "subsurfaceTransportFunctions.pyx":425
10716  * pcBar = alpha[matID]*psiC
10717  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10718  * pcBar_nM1 = pcBar_nM2*pcBar # <<<<<<<<<<<<<<
10719  * pcBar_n = pcBar_nM1*pcBar
10720  * onePlus_pcBar_n = 1.0 + pcBar_n
10721  */
10722  __pyx_v_pcBar_nM1 = (__pyx_v_pcBar_nM2 * __pyx_v_pcBar);
10723 
10724  /* "subsurfaceTransportFunctions.pyx":426
10725  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10726  * pcBar_nM1 = pcBar_nM2*pcBar
10727  * pcBar_n = pcBar_nM1*pcBar # <<<<<<<<<<<<<<
10728  * onePlus_pcBar_n = 1.0 + pcBar_n
10729  *
10730  */
10731  __pyx_v_pcBar_n = (__pyx_v_pcBar_nM1 * __pyx_v_pcBar);
10732 
10733  /* "subsurfaceTransportFunctions.pyx":427
10734  * pcBar_nM1 = pcBar_nM2*pcBar
10735  * pcBar_n = pcBar_nM1*pcBar
10736  * onePlus_pcBar_n = 1.0 + pcBar_n # <<<<<<<<<<<<<<
10737  *
10738  * sBar = pow(onePlus_pcBar_n,-m)
10739  */
10740  __pyx_v_onePlus_pcBar_n = (1.0 + __pyx_v_pcBar_n);
10741 
10742  /* "subsurfaceTransportFunctions.pyx":429
10743  * onePlus_pcBar_n = 1.0 + pcBar_n
10744  *
10745  * sBar = pow(onePlus_pcBar_n,-m) # <<<<<<<<<<<<<<
10746  * # using -mn = 1-n
10747  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10748  */
10749  __pyx_v_sBar = pow(__pyx_v_onePlus_pcBar_n, (-__pyx_v_m));
10750 
10751  /* "subsurfaceTransportFunctions.pyx":431
10752  * sBar = pow(onePlus_pcBar_n,-m)
10753  * # using -mn = 1-n
10754  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1 # <<<<<<<<<<<<<<
10755  *
10756  * vBar = 1.0-pcBar_nM1*sBar
10757  */
10758  __pyx_t_27 = __pyx_v_matID;
10759  __pyx_t_17 = -1;
10760  if (__pyx_t_27 < 0) {
10761  __pyx_t_27 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10762  if (unlikely(__pyx_t_27 < 0)) __pyx_t_17 = 0;
10763  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_17 = 0;
10764  if (unlikely(__pyx_t_17 != -1)) {
10765  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10766  __PYX_ERR(0, 431, __pyx_L1_error)
10767  }
10768  __pyx_t_28 = __pyx_v_matID;
10769  __pyx_t_17 = -1;
10770  if (__pyx_t_28 < 0) {
10771  __pyx_t_28 += __pyx_pybuffernd_n.diminfo[0].shape;
10772  if (unlikely(__pyx_t_28 < 0)) __pyx_t_17 = 0;
10773  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
10774  if (unlikely(__pyx_t_17 != -1)) {
10775  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10776  __PYX_ERR(0, 431, __pyx_L1_error)
10777  }
10778  if (unlikely(__pyx_v_onePlus_pcBar_n == 0)) {
10779  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10780  __PYX_ERR(0, 431, __pyx_L1_error)
10781  }
10782  __pyx_v_DsBar_DpsiC = ((((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_alpha.diminfo[0].strides)) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_n.diminfo[0].strides)))) * (__pyx_v_sBar / __pyx_v_onePlus_pcBar_n)) * __pyx_v_pcBar_nM1);
10783 
10784  /* "subsurfaceTransportFunctions.pyx":433
10785  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10786  *
10787  * vBar = 1.0-pcBar_nM1*sBar # <<<<<<<<<<<<<<
10788  * vBar2 = vBar*vBar
10789  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10790  */
10791  __pyx_v_vBar = (1.0 - (__pyx_v_pcBar_nM1 * __pyx_v_sBar));
10792 
10793  /* "subsurfaceTransportFunctions.pyx":434
10794  *
10795  * vBar = 1.0-pcBar_nM1*sBar
10796  * vBar2 = vBar*vBar # <<<<<<<<<<<<<<
10797  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10798  *
10799  */
10800  __pyx_v_vBar2 = (__pyx_v_vBar * __pyx_v_vBar);
10801 
10802  /* "subsurfaceTransportFunctions.pyx":435
10803  * vBar = 1.0-pcBar_nM1*sBar
10804  * vBar2 = vBar*vBar
10805  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC # <<<<<<<<<<<<<<
10806  *
10807  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
10808  */
10809  __pyx_t_29 = __pyx_v_matID;
10810  __pyx_t_17 = -1;
10811  if (__pyx_t_29 < 0) {
10812  __pyx_t_29 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10813  if (unlikely(__pyx_t_29 < 0)) __pyx_t_17 = 0;
10814  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_17 = 0;
10815  if (unlikely(__pyx_t_17 != -1)) {
10816  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10817  __PYX_ERR(0, 435, __pyx_L1_error)
10818  }
10819  __pyx_t_30 = __pyx_v_matID;
10820  __pyx_t_17 = -1;
10821  if (__pyx_t_30 < 0) {
10822  __pyx_t_30 += __pyx_pybuffernd_n.diminfo[0].shape;
10823  if (unlikely(__pyx_t_30 < 0)) __pyx_t_17 = 0;
10824  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
10825  if (unlikely(__pyx_t_17 != -1)) {
10826  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10827  __PYX_ERR(0, 435, __pyx_L1_error)
10828  }
10829  __pyx_v_DvBar_DpsiC = (((((-(*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_alpha.diminfo[0].strides))) * ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_n.diminfo[0].strides)) - 1.0)) * __pyx_v_pcBar_nM2) * __pyx_v_sBar) - (__pyx_v_pcBar_nM1 * __pyx_v_DsBar_DpsiC));
10830 
10831  /* "subsurfaceTransportFunctions.pyx":437
10832  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10833  *
10834  * thetaW = thetaSR[matID]*sBar + thetaR[matID] # <<<<<<<<<<<<<<
10835  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
10836  *
10837  */
10838  __pyx_t_31 = __pyx_v_matID;
10839  __pyx_t_17 = -1;
10840  if (__pyx_t_31 < 0) {
10841  __pyx_t_31 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10842  if (unlikely(__pyx_t_31 < 0)) __pyx_t_17 = 0;
10843  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_17 = 0;
10844  if (unlikely(__pyx_t_17 != -1)) {
10845  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10846  __PYX_ERR(0, 437, __pyx_L1_error)
10847  }
10848  __pyx_t_32 = __pyx_v_matID;
10849  __pyx_t_17 = -1;
10850  if (__pyx_t_32 < 0) {
10851  __pyx_t_32 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
10852  if (unlikely(__pyx_t_32 < 0)) __pyx_t_17 = 0;
10853  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_17 = 0;
10854  if (unlikely(__pyx_t_17 != -1)) {
10855  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10856  __PYX_ERR(0, 437, __pyx_L1_error)
10857  }
10858  __pyx_v_thetaW = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_sBar) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_thetaR.diminfo[0].strides)));
10859 
10860  /* "subsurfaceTransportFunctions.pyx":438
10861  *
10862  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
10863  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC # <<<<<<<<<<<<<<
10864  *
10865  * sqrt_sBar = sqrt(sBar)
10866  */
10867  __pyx_t_33 = __pyx_v_matID;
10868  __pyx_t_17 = -1;
10869  if (__pyx_t_33 < 0) {
10870  __pyx_t_33 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10871  if (unlikely(__pyx_t_33 < 0)) __pyx_t_17 = 0;
10872  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_17 = 0;
10873  if (unlikely(__pyx_t_17 != -1)) {
10874  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10875  __PYX_ERR(0, 438, __pyx_L1_error)
10876  }
10877  __pyx_v_DthetaW_DpsiC = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_DsBar_DpsiC);
10878 
10879  /* "subsurfaceTransportFunctions.pyx":440
10880  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
10881  *
10882  * sqrt_sBar = sqrt(sBar) # <<<<<<<<<<<<<<
10883  * KWr= sqrt_sBar*vBar2
10884  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10885  */
10886  __pyx_v_sqrt_sBar = sqrt(__pyx_v_sBar);
10887 
10888  /* "subsurfaceTransportFunctions.pyx":441
10889  *
10890  * sqrt_sBar = sqrt(sBar)
10891  * KWr= sqrt_sBar*vBar2 # <<<<<<<<<<<<<<
10892  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10893  * else:
10894  */
10895  __pyx_v_KWr = (__pyx_v_sqrt_sBar * __pyx_v_vBar2);
10896 
10897  /* "subsurfaceTransportFunctions.pyx":442
10898  * sqrt_sBar = sqrt(sBar)
10899  * KWr= sqrt_sBar*vBar2
10900  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC) # <<<<<<<<<<<<<<
10901  * else:
10902  * thetaW = thetaS
10903  */
10904  if (unlikely(__pyx_v_sqrt_sBar == 0)) {
10905  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10906  __PYX_ERR(0, 442, __pyx_L1_error)
10907  }
10908  __pyx_v_DKWr_DpsiC = ((((0.5 / __pyx_v_sqrt_sBar) * __pyx_v_DsBar_DpsiC) * __pyx_v_vBar2) + (((2.0 * __pyx_v_sqrt_sBar) * __pyx_v_vBar) * __pyx_v_DvBar_DpsiC));
10909 
10910  /* "subsurfaceTransportFunctions.pyx":422
10911  * m = 1.0 - 1.0/n[matID]
10912  * thetaS = thetaR[matID] + thetaSR[matID]
10913  * if psiC > 0.0: # <<<<<<<<<<<<<<
10914  * pcBar = alpha[matID]*psiC
10915  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10916  */
10917  goto __pyx_L9;
10918  }
10919 
10920  /* "subsurfaceTransportFunctions.pyx":444
10921  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10922  * else:
10923  * thetaW = thetaS # <<<<<<<<<<<<<<
10924  * DthetaW_DpsiC = 0.0
10925  * KWr = 1.0
10926  */
10927  /*else*/ {
10928  __pyx_v_thetaW = __pyx_v_thetaS;
10929 
10930  /* "subsurfaceTransportFunctions.pyx":445
10931  * else:
10932  * thetaW = thetaS
10933  * DthetaW_DpsiC = 0.0 # <<<<<<<<<<<<<<
10934  * KWr = 1.0
10935  * DKWr_DpsiC = 0.0
10936  */
10937  __pyx_v_DthetaW_DpsiC = 0.0;
10938 
10939  /* "subsurfaceTransportFunctions.pyx":446
10940  * thetaW = thetaS
10941  * DthetaW_DpsiC = 0.0
10942  * KWr = 1.0 # <<<<<<<<<<<<<<
10943  * DKWr_DpsiC = 0.0
10944  * #
10945  */
10946  __pyx_v_KWr = 1.0;
10947 
10948  /* "subsurfaceTransportFunctions.pyx":447
10949  * DthetaW_DpsiC = 0.0
10950  * KWr = 1.0
10951  * DKWr_DpsiC = 0.0 # <<<<<<<<<<<<<<
10952  * #
10953  * rhom = rho*exp(beta*u_j)
10954  */
10955  __pyx_v_DKWr_DpsiC = 0.0;
10956  }
10957  __pyx_L9:;
10958 
10959  /* "subsurfaceTransportFunctions.pyx":449
10960  * DKWr_DpsiC = 0.0
10961  * #
10962  * rhom = rho*exp(beta*u_j) # <<<<<<<<<<<<<<
10963  * drhom= beta*rhom
10964  * q_mass[eN,j] = rhom*thetaW
10965  */
10966  __pyx_v_rhom = (__pyx_v_rho * exp((__pyx_v_beta * __pyx_v_u_j)));
10967 
10968  /* "subsurfaceTransportFunctions.pyx":450
10969  * #
10970  * rhom = rho*exp(beta*u_j)
10971  * drhom= beta*rhom # <<<<<<<<<<<<<<
10972  * q_mass[eN,j] = rhom*thetaW
10973  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
10974  */
10975  __pyx_v_drhom = (__pyx_v_beta * __pyx_v_rhom);
10976 
10977  /* "subsurfaceTransportFunctions.pyx":451
10978  * rhom = rho*exp(beta*u_j)
10979  * drhom= beta*rhom
10980  * q_mass[eN,j] = rhom*thetaW # <<<<<<<<<<<<<<
10981  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
10982  *
10983  */
10984  __pyx_t_34 = __pyx_v_eN;
10985  __pyx_t_35 = __pyx_v_j;
10986  __pyx_t_17 = -1;
10987  if (__pyx_t_34 < 0) {
10988  __pyx_t_34 += __pyx_pybuffernd_q_mass.diminfo[0].shape;
10989  if (unlikely(__pyx_t_34 < 0)) __pyx_t_17 = 0;
10990  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_mass.diminfo[0].shape)) __pyx_t_17 = 0;
10991  if (__pyx_t_35 < 0) {
10992  __pyx_t_35 += __pyx_pybuffernd_q_mass.diminfo[1].shape;
10993  if (unlikely(__pyx_t_35 < 0)) __pyx_t_17 = 1;
10994  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_mass.diminfo[1].shape)) __pyx_t_17 = 1;
10995  if (unlikely(__pyx_t_17 != -1)) {
10996  __Pyx_RaiseBufferIndexError(__pyx_t_17);
10997  __PYX_ERR(0, 451, __pyx_L1_error)
10998  }
10999  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_q_mass.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_q_mass.diminfo[1].strides) = (__pyx_v_rhom * __pyx_v_thetaW);
11000 
11001  /* "subsurfaceTransportFunctions.pyx":452
11002  * drhom= beta*rhom
11003  * q_mass[eN,j] = rhom*thetaW
11004  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW # <<<<<<<<<<<<<<
11005  *
11006  * q_kr[eN,j] = KWr
11007  */
11008  __pyx_t_36 = __pyx_v_eN;
11009  __pyx_t_37 = __pyx_v_j;
11010  __pyx_t_17 = -1;
11011  if (__pyx_t_36 < 0) {
11012  __pyx_t_36 += __pyx_pybuffernd_q_dmass.diminfo[0].shape;
11013  if (unlikely(__pyx_t_36 < 0)) __pyx_t_17 = 0;
11014  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_dmass.diminfo[0].shape)) __pyx_t_17 = 0;
11015  if (__pyx_t_37 < 0) {
11016  __pyx_t_37 += __pyx_pybuffernd_q_dmass.diminfo[1].shape;
11017  if (unlikely(__pyx_t_37 < 0)) __pyx_t_17 = 1;
11018  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_q_dmass.diminfo[1].shape)) __pyx_t_17 = 1;
11019  if (unlikely(__pyx_t_17 != -1)) {
11020  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11021  __PYX_ERR(0, 452, __pyx_L1_error)
11022  }
11023  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_q_dmass.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_q_dmass.diminfo[1].strides) = (((-__pyx_v_rhom) * __pyx_v_DthetaW_DpsiC) + (__pyx_v_drhom * __pyx_v_thetaW));
11024 
11025  /* "subsurfaceTransportFunctions.pyx":454
11026  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11027  *
11028  * q_kr[eN,j] = KWr # <<<<<<<<<<<<<<
11029  * q_dkr[eN,j]= -DKWr_DpsiC
11030  *
11031  */
11032  __pyx_t_38 = __pyx_v_eN;
11033  __pyx_t_39 = __pyx_v_j;
11034  __pyx_t_17 = -1;
11035  if (__pyx_t_38 < 0) {
11036  __pyx_t_38 += __pyx_pybuffernd_q_kr.diminfo[0].shape;
11037  if (unlikely(__pyx_t_38 < 0)) __pyx_t_17 = 0;
11038  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_kr.diminfo[0].shape)) __pyx_t_17 = 0;
11039  if (__pyx_t_39 < 0) {
11040  __pyx_t_39 += __pyx_pybuffernd_q_kr.diminfo[1].shape;
11041  if (unlikely(__pyx_t_39 < 0)) __pyx_t_17 = 1;
11042  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_kr.diminfo[1].shape)) __pyx_t_17 = 1;
11043  if (unlikely(__pyx_t_17 != -1)) {
11044  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11045  __PYX_ERR(0, 454, __pyx_L1_error)
11046  }
11047  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_q_kr.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_q_kr.diminfo[1].strides) = __pyx_v_KWr;
11048 
11049  /* "subsurfaceTransportFunctions.pyx":455
11050  *
11051  * q_kr[eN,j] = KWr
11052  * q_dkr[eN,j]= -DKWr_DpsiC # <<<<<<<<<<<<<<
11053  *
11054  * #j
11055  */
11056  __pyx_t_40 = __pyx_v_eN;
11057  __pyx_t_41 = __pyx_v_j;
11058  __pyx_t_17 = -1;
11059  if (__pyx_t_40 < 0) {
11060  __pyx_t_40 += __pyx_pybuffernd_q_dkr.diminfo[0].shape;
11061  if (unlikely(__pyx_t_40 < 0)) __pyx_t_17 = 0;
11062  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_q_dkr.diminfo[0].shape)) __pyx_t_17 = 0;
11063  if (__pyx_t_41 < 0) {
11064  __pyx_t_41 += __pyx_pybuffernd_q_dkr.diminfo[1].shape;
11065  if (unlikely(__pyx_t_41 < 0)) __pyx_t_17 = 1;
11066  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_dkr.diminfo[1].shape)) __pyx_t_17 = 1;
11067  if (unlikely(__pyx_t_17 != -1)) {
11068  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11069  __PYX_ERR(0, 455, __pyx_L1_error)
11070  }
11071  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_q_dkr.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_q_dkr.diminfo[1].strides) = (-__pyx_v_DKWr_DpsiC);
11072  }
11073  }
11074 
11075  /* "subsurfaceTransportFunctions.pyx":461
11076  *
11077  * #now upwind kr
11078  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
11079  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
11080  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11081  */
11082  __pyx_t_8 = __pyx_v_nElements_global;
11083  __pyx_t_9 = __pyx_t_8;
11084  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
11085  __pyx_v_eN = __pyx_t_10;
11086 
11087  /* "subsurfaceTransportFunctions.pyx":462
11088  * #now upwind kr
11089  * for eN in range(nElements_global):
11090  * u_eN = numpy.sum(q_u[eN])*nAvgWeight # <<<<<<<<<<<<<<
11091  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11092  * #potential assumes slight compressibility
11093  */
11094  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11095  __Pyx_GOTREF(__pyx_t_5);
11096  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
11097  __Pyx_GOTREF(__pyx_t_1);
11098  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11099  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11100  __Pyx_GOTREF(__pyx_t_5);
11101  __pyx_t_4 = NULL;
11102  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11103  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
11104  if (likely(__pyx_t_4)) {
11105  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11106  __Pyx_INCREF(__pyx_t_4);
11107  __Pyx_INCREF(function);
11108  __Pyx_DECREF_SET(__pyx_t_1, function);
11109  }
11110  }
11111  if (!__pyx_t_4) {
11112  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
11113  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11114  __Pyx_GOTREF(__pyx_t_2);
11115  } else {
11116  #if CYTHON_FAST_PYCALL
11117  if (PyFunction_Check(__pyx_t_1)) {
11118  PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
11119  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
11120  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11121  __Pyx_GOTREF(__pyx_t_2);
11122  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11123  } else
11124  #endif
11125  #if CYTHON_FAST_PYCCALL
11126  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
11127  PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
11128  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
11129  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11130  __Pyx_GOTREF(__pyx_t_2);
11131  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11132  } else
11133  #endif
11134  {
11135  __pyx_t_42 = PyTuple_New(1+1); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 462, __pyx_L1_error)
11136  __Pyx_GOTREF(__pyx_t_42);
11137  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_42, 0, __pyx_t_4); __pyx_t_4 = NULL;
11138  __Pyx_GIVEREF(__pyx_t_5);
11139  PyTuple_SET_ITEM(__pyx_t_42, 0+1, __pyx_t_5);
11140  __pyx_t_5 = 0;
11141  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_42, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
11142  __Pyx_GOTREF(__pyx_t_2);
11143  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11144  }
11145  }
11146  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11147  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
11148  __Pyx_GOTREF(__pyx_t_1);
11149  __pyx_t_42 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 462, __pyx_L1_error)
11150  __Pyx_GOTREF(__pyx_t_42);
11151  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11152  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11153  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_42); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 462, __pyx_L1_error)
11154  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11155  __pyx_v_u_eN = __pyx_t_7;
11156 
11157  /* "subsurfaceTransportFunctions.pyx":463
11158  * for eN in range(nElements_global):
11159  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
11160  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight # <<<<<<<<<<<<<<
11161  * #potential assumes slight compressibility
11162  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN])
11163  */
11164  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11165  __Pyx_GOTREF(__pyx_t_1);
11166  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
11167  __Pyx_GOTREF(__pyx_t_2);
11168  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11169  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11170  __Pyx_GOTREF(__pyx_t_1);
11171  __pyx_t_5 = NULL;
11172  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
11173  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
11174  if (likely(__pyx_t_5)) {
11175  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11176  __Pyx_INCREF(__pyx_t_5);
11177  __Pyx_INCREF(function);
11178  __Pyx_DECREF_SET(__pyx_t_2, function);
11179  }
11180  }
11181  if (!__pyx_t_5) {
11182  __pyx_t_42 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 463, __pyx_L1_error)
11183  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11184  __Pyx_GOTREF(__pyx_t_42);
11185  } else {
11186  #if CYTHON_FAST_PYCALL
11187  if (PyFunction_Check(__pyx_t_2)) {
11188  PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1};
11189  __pyx_t_42 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 463, __pyx_L1_error)
11190  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11191  __Pyx_GOTREF(__pyx_t_42);
11192  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11193  } else
11194  #endif
11195  #if CYTHON_FAST_PYCCALL
11196  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
11197  PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1};
11198  __pyx_t_42 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 463, __pyx_L1_error)
11199  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11200  __Pyx_GOTREF(__pyx_t_42);
11201  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11202  } else
11203  #endif
11204  {
11205  __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error)
11206  __Pyx_GOTREF(__pyx_t_4);
11207  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
11208  __Pyx_GIVEREF(__pyx_t_1);
11209  PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_1);
11210  __pyx_t_1 = 0;
11211  __pyx_t_42 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 463, __pyx_L1_error)
11212  __Pyx_GOTREF(__pyx_t_42);
11213  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11214  }
11215  }
11216  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11217  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
11218  __Pyx_GOTREF(__pyx_t_2);
11219  __pyx_t_4 = PyNumber_Multiply(__pyx_t_42, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error)
11220  __Pyx_GOTREF(__pyx_t_4);
11221  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11222  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11223  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error)
11224  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11225  __pyx_v_kr_eN = __pyx_t_7;
11226 
11227  /* "subsurfaceTransportFunctions.pyx":465
11228  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11229  * #potential assumes slight compressibility
11230  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN]) # <<<<<<<<<<<<<<
11231  *
11232  *
11233  */
11234  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_u_eN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
11235  __Pyx_GOTREF(__pyx_t_4);
11236  __pyx_t_42 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 465, __pyx_L1_error)
11237  __Pyx_GOTREF(__pyx_t_42);
11238  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_dot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
11239  __Pyx_GOTREF(__pyx_t_1);
11240  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11241  __pyx_t_42 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 465, __pyx_L1_error)
11242  __Pyx_GOTREF(__pyx_t_42);
11243  __pyx_t_5 = NULL;
11244  __pyx_t_12 = 0;
11245  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11246  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
11247  if (likely(__pyx_t_5)) {
11248  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11249  __Pyx_INCREF(__pyx_t_5);
11250  __Pyx_INCREF(function);
11251  __Pyx_DECREF_SET(__pyx_t_1, function);
11252  __pyx_t_12 = 1;
11253  }
11254  }
11255  #if CYTHON_FAST_PYCALL
11256  if (PyFunction_Check(__pyx_t_1)) {
11257  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_42};
11258  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11259  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11260  __Pyx_GOTREF(__pyx_t_2);
11261  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11262  } else
11263  #endif
11264  #if CYTHON_FAST_PYCCALL
11265  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
11266  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_42};
11267  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11268  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11269  __Pyx_GOTREF(__pyx_t_2);
11270  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11271  } else
11272  #endif
11273  {
11274  __pyx_t_43 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 465, __pyx_L1_error)
11275  __Pyx_GOTREF(__pyx_t_43);
11276  if (__pyx_t_5) {
11277  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_43, 0, __pyx_t_5); __pyx_t_5 = NULL;
11278  }
11279  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
11280  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
11281  PyTuple_SET_ITEM(__pyx_t_43, 0+__pyx_t_12, ((PyObject *)__pyx_v_gravity));
11282  __Pyx_GIVEREF(__pyx_t_42);
11283  PyTuple_SET_ITEM(__pyx_t_43, 1+__pyx_t_12, __pyx_t_42);
11284  __pyx_t_42 = 0;
11285  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_43, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11286  __Pyx_GOTREF(__pyx_t_2);
11287  __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
11288  }
11289  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11290  __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
11291  __Pyx_GOTREF(__pyx_t_1);
11292  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11293  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11294  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L1_error)
11295  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11296  __pyx_v_phi_eN = __pyx_t_7;
11297 
11298  /* "subsurfaceTransportFunctions.pyx":469
11299  *
11300  * #loop over faces to upwind
11301  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
11302  * #by default eN is upwind
11303  * q_kr_up[eN,ebN] = kr_eN
11304  */
11305  __pyx_t_12 = __pyx_v_nElementBoundaries_element;
11306  __pyx_t_13 = __pyx_t_12;
11307  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
11308  __pyx_v_ebN = __pyx_t_14;
11309 
11310  /* "subsurfaceTransportFunctions.pyx":471
11311  * for ebN in range(nElementBoundaries_element):
11312  * #by default eN is upwind
11313  * q_kr_up[eN,ebN] = kr_eN # <<<<<<<<<<<<<<
11314  * eN_neighbor = elementNeighborsArray[eN,ebN]
11315  * if eN_neighbor >= 0:
11316  */
11317  __pyx_t_44 = __pyx_v_eN;
11318  __pyx_t_45 = __pyx_v_ebN;
11319  __pyx_t_17 = -1;
11320  if (__pyx_t_44 < 0) {
11321  __pyx_t_44 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11322  if (unlikely(__pyx_t_44 < 0)) __pyx_t_17 = 0;
11323  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_17 = 0;
11324  if (__pyx_t_45 < 0) {
11325  __pyx_t_45 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11326  if (unlikely(__pyx_t_45 < 0)) __pyx_t_17 = 1;
11327  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_17 = 1;
11328  if (unlikely(__pyx_t_17 != -1)) {
11329  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11330  __PYX_ERR(0, 471, __pyx_L1_error)
11331  }
11332  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_eN;
11333 
11334  /* "subsurfaceTransportFunctions.pyx":472
11335  * #by default eN is upwind
11336  * q_kr_up[eN,ebN] = kr_eN
11337  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
11338  * if eN_neighbor >= 0:
11339  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11340  */
11341  __pyx_t_46 = __pyx_v_eN;
11342  __pyx_t_47 = __pyx_v_ebN;
11343  __pyx_t_17 = -1;
11344  if (__pyx_t_46 < 0) {
11345  __pyx_t_46 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
11346  if (unlikely(__pyx_t_46 < 0)) __pyx_t_17 = 0;
11347  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_17 = 0;
11348  if (__pyx_t_47 < 0) {
11349  __pyx_t_47 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
11350  if (unlikely(__pyx_t_47 < 0)) __pyx_t_17 = 1;
11351  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_17 = 1;
11352  if (unlikely(__pyx_t_17 != -1)) {
11353  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11354  __PYX_ERR(0, 472, __pyx_L1_error)
11355  }
11356  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
11357 
11358  /* "subsurfaceTransportFunctions.pyx":473
11359  * q_kr_up[eN,ebN] = kr_eN
11360  * eN_neighbor = elementNeighborsArray[eN,ebN]
11361  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
11362  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11363  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11364  */
11365  __pyx_t_6 = ((__pyx_v_eN_neighbor >= 0) != 0);
11366  if (__pyx_t_6) {
11367 
11368  /* "subsurfaceTransportFunctions.pyx":474
11369  * eN_neighbor = elementNeighborsArray[eN,ebN]
11370  * if eN_neighbor >= 0:
11371  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
11372  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11373  * #potential, assumes slight compressibility
11374  */
11375  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11376  __Pyx_GOTREF(__pyx_t_2);
11377  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error)
11378  __Pyx_GOTREF(__pyx_t_4);
11379  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11380  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11381  __Pyx_GOTREF(__pyx_t_2);
11382  __pyx_t_43 = NULL;
11383  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11384  __pyx_t_43 = PyMethod_GET_SELF(__pyx_t_4);
11385  if (likely(__pyx_t_43)) {
11386  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11387  __Pyx_INCREF(__pyx_t_43);
11388  __Pyx_INCREF(function);
11389  __Pyx_DECREF_SET(__pyx_t_4, function);
11390  }
11391  }
11392  if (!__pyx_t_43) {
11393  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11394  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11395  __Pyx_GOTREF(__pyx_t_1);
11396  } else {
11397  #if CYTHON_FAST_PYCALL
11398  if (PyFunction_Check(__pyx_t_4)) {
11399  PyObject *__pyx_temp[2] = {__pyx_t_43, __pyx_t_2};
11400  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11401  __Pyx_XDECREF(__pyx_t_43); __pyx_t_43 = 0;
11402  __Pyx_GOTREF(__pyx_t_1);
11403  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11404  } else
11405  #endif
11406  #if CYTHON_FAST_PYCCALL
11407  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
11408  PyObject *__pyx_temp[2] = {__pyx_t_43, __pyx_t_2};
11409  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11410  __Pyx_XDECREF(__pyx_t_43); __pyx_t_43 = 0;
11411  __Pyx_GOTREF(__pyx_t_1);
11412  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11413  } else
11414  #endif
11415  {
11416  __pyx_t_42 = PyTuple_New(1+1); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 474, __pyx_L1_error)
11417  __Pyx_GOTREF(__pyx_t_42);
11418  __Pyx_GIVEREF(__pyx_t_43); PyTuple_SET_ITEM(__pyx_t_42, 0, __pyx_t_43); __pyx_t_43 = NULL;
11419  __Pyx_GIVEREF(__pyx_t_2);
11420  PyTuple_SET_ITEM(__pyx_t_42, 0+1, __pyx_t_2);
11421  __pyx_t_2 = 0;
11422  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11423  __Pyx_GOTREF(__pyx_t_1);
11424  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11425  }
11426  }
11427  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11428  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error)
11429  __Pyx_GOTREF(__pyx_t_4);
11430  __pyx_t_42 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 474, __pyx_L1_error)
11431  __Pyx_GOTREF(__pyx_t_42);
11432  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11433  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11434  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_42); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 474, __pyx_L1_error)
11435  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11436  __pyx_v_u_neig = __pyx_t_7;
11437 
11438  /* "subsurfaceTransportFunctions.pyx":475
11439  * if eN_neighbor >= 0:
11440  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11441  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
11442  * #potential, assumes slight compressibility
11443  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11444  */
11445  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
11446  __Pyx_GOTREF(__pyx_t_4);
11447  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11448  __Pyx_GOTREF(__pyx_t_1);
11449  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11450  __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
11451  __Pyx_GOTREF(__pyx_t_4);
11452  __pyx_t_2 = NULL;
11453  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11454  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
11455  if (likely(__pyx_t_2)) {
11456  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11457  __Pyx_INCREF(__pyx_t_2);
11458  __Pyx_INCREF(function);
11459  __Pyx_DECREF_SET(__pyx_t_1, function);
11460  }
11461  }
11462  if (!__pyx_t_2) {
11463  __pyx_t_42 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 475, __pyx_L1_error)
11464  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11465  __Pyx_GOTREF(__pyx_t_42);
11466  } else {
11467  #if CYTHON_FAST_PYCALL
11468  if (PyFunction_Check(__pyx_t_1)) {
11469  PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
11470  __pyx_t_42 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 475, __pyx_L1_error)
11471  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11472  __Pyx_GOTREF(__pyx_t_42);
11473  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11474  } else
11475  #endif
11476  #if CYTHON_FAST_PYCCALL
11477  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
11478  PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
11479  __pyx_t_42 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 475, __pyx_L1_error)
11480  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11481  __Pyx_GOTREF(__pyx_t_42);
11482  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11483  } else
11484  #endif
11485  {
11486  __pyx_t_43 = PyTuple_New(1+1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 475, __pyx_L1_error)
11487  __Pyx_GOTREF(__pyx_t_43);
11488  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_43, 0, __pyx_t_2); __pyx_t_2 = NULL;
11489  __Pyx_GIVEREF(__pyx_t_4);
11490  PyTuple_SET_ITEM(__pyx_t_43, 0+1, __pyx_t_4);
11491  __pyx_t_4 = 0;
11492  __pyx_t_42 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_43, NULL); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 475, __pyx_L1_error)
11493  __Pyx_GOTREF(__pyx_t_42);
11494  __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
11495  }
11496  }
11497  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11498  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11499  __Pyx_GOTREF(__pyx_t_1);
11500  __pyx_t_43 = PyNumber_Multiply(__pyx_t_42, __pyx_t_1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 475, __pyx_L1_error)
11501  __Pyx_GOTREF(__pyx_t_43);
11502  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11503  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11504  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_43); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 475, __pyx_L1_error)
11505  __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
11506  __pyx_v_kr_neig = __pyx_t_7;
11507 
11508  /* "subsurfaceTransportFunctions.pyx":477
11509  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11510  * #potential, assumes slight compressibility
11511  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor]) # <<<<<<<<<<<<<<
11512  *
11513  * if phi_eN < phi_neig: #neighbor is upwind
11514  */
11515  __pyx_t_43 = PyFloat_FromDouble(__pyx_v_u_neig); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 477, __pyx_L1_error)
11516  __Pyx_GOTREF(__pyx_t_43);
11517  __pyx_t_42 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 477, __pyx_L1_error)
11518  __Pyx_GOTREF(__pyx_t_42);
11519  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11520  __Pyx_GOTREF(__pyx_t_4);
11521  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11522  __pyx_t_42 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 477, __pyx_L1_error)
11523  __Pyx_GOTREF(__pyx_t_42);
11524  __pyx_t_2 = NULL;
11525  __pyx_t_17 = 0;
11526  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11527  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
11528  if (likely(__pyx_t_2)) {
11529  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11530  __Pyx_INCREF(__pyx_t_2);
11531  __Pyx_INCREF(function);
11532  __Pyx_DECREF_SET(__pyx_t_4, function);
11533  __pyx_t_17 = 1;
11534  }
11535  }
11536  #if CYTHON_FAST_PYCALL
11537  if (PyFunction_Check(__pyx_t_4)) {
11538  PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_gravity), __pyx_t_42};
11539  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
11540  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11541  __Pyx_GOTREF(__pyx_t_1);
11542  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11543  } else
11544  #endif
11545  #if CYTHON_FAST_PYCCALL
11546  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
11547  PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_gravity), __pyx_t_42};
11548  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
11549  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11550  __Pyx_GOTREF(__pyx_t_1);
11551  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
11552  } else
11553  #endif
11554  {
11555  __pyx_t_5 = PyTuple_New(2+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 477, __pyx_L1_error)
11556  __Pyx_GOTREF(__pyx_t_5);
11557  if (__pyx_t_2) {
11558  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
11559  }
11560  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
11561  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
11562  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_17, ((PyObject *)__pyx_v_gravity));
11563  __Pyx_GIVEREF(__pyx_t_42);
11564  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_17, __pyx_t_42);
11565  __pyx_t_42 = 0;
11566  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
11567  __Pyx_GOTREF(__pyx_t_1);
11568  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11569  }
11570  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11571  __pyx_t_4 = PyNumber_Subtract(__pyx_t_43, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11572  __Pyx_GOTREF(__pyx_t_4);
11573  __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
11574  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11575  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L1_error)
11576  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11577  __pyx_v_phi_neig = __pyx_t_7;
11578 
11579  /* "subsurfaceTransportFunctions.pyx":479
11580  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11581  *
11582  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11583  * q_kr_up[eN,ebN] = kr_neig
11584  *
11585  */
11586  __pyx_t_6 = ((__pyx_v_phi_eN < __pyx_v_phi_neig) != 0);
11587  if (__pyx_t_6) {
11588 
11589  /* "subsurfaceTransportFunctions.pyx":480
11590  *
11591  * if phi_eN < phi_neig: #neighbor is upwind
11592  * q_kr_up[eN,ebN] = kr_neig # <<<<<<<<<<<<<<
11593  *
11594  * #neighbor
11595  */
11596  __pyx_t_48 = __pyx_v_eN;
11597  __pyx_t_49 = __pyx_v_ebN;
11598  __pyx_t_17 = -1;
11599  if (__pyx_t_48 < 0) {
11600  __pyx_t_48 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11601  if (unlikely(__pyx_t_48 < 0)) __pyx_t_17 = 0;
11602  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_17 = 0;
11603  if (__pyx_t_49 < 0) {
11604  __pyx_t_49 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11605  if (unlikely(__pyx_t_49 < 0)) __pyx_t_17 = 1;
11606  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_17 = 1;
11607  if (unlikely(__pyx_t_17 != -1)) {
11608  __Pyx_RaiseBufferIndexError(__pyx_t_17);
11609  __PYX_ERR(0, 480, __pyx_L1_error)
11610  }
11611  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_neig;
11612 
11613  /* "subsurfaceTransportFunctions.pyx":479
11614  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11615  *
11616  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11617  * q_kr_up[eN,ebN] = kr_neig
11618  *
11619  */
11620  }
11621 
11622  /* "subsurfaceTransportFunctions.pyx":473
11623  * q_kr_up[eN,ebN] = kr_eN
11624  * eN_neighbor = elementNeighborsArray[eN,ebN]
11625  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
11626  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11627  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11628  */
11629  }
11630  }
11631  }
11632 
11633  /* "subsurfaceTransportFunctions.pyx":359
11634  *
11635  *
11636  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
11637  * double beta,
11638  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
11639  */
11640 
11641  /* function exit code */
11642  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11643  goto __pyx_L0;
11644  __pyx_L1_error:;
11645  __Pyx_XDECREF(__pyx_t_1);
11646  __Pyx_XDECREF(__pyx_t_2);
11647  __Pyx_XDECREF(__pyx_t_4);
11648  __Pyx_XDECREF(__pyx_t_5);
11649  __Pyx_XDECREF(__pyx_t_42);
11650  __Pyx_XDECREF(__pyx_t_43);
11651  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
11652  __Pyx_PyThreadState_declare
11653  __Pyx_PyThreadState_assign
11654  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
11655  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11656  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11657  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11658  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11659  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11660  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11661  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11662  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11663  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11664  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11665  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11666  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11667  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11668  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11669  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11670  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11671  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11672  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11673  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
11674  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
11675  __pyx_r = NULL;
11676  goto __pyx_L2;
11677  __pyx_L0:;
11678  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11679  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11680  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11681  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11682  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11683  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11684  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11685  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11686  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11687  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11688  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11689  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11690  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11691  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11692  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11693  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11694  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11695  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11696  __pyx_L2:;
11697  __Pyx_XDECREF(__pyx_v_q);
11698  __Pyx_XGIVEREF(__pyx_r);
11699  __Pyx_RefNannyFinishContext();
11700  return __pyx_r;
11701 }
11702 
11703 /* "subsurfaceTransportFunctions.pyx":486
11704  * #eN for upwind
11705  *
11706  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
11707  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
11708  * numpy.ndarray[ITYPE_t,ndim=1] colind,
11709  */
11710 
11711 /* Python wrapper */
11712 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11713 static char __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
11714 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual = {"RE_NCP1_getElementResidual", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual};
11715 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11716  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
11717  PyArrayObject *__pyx_v_rowptr = 0;
11718  PyArrayObject *__pyx_v_colind = 0;
11719  int __pyx_v_nSpace;
11720  int __pyx_v_nElements_global;
11721  int __pyx_v_nElementBoundaries_element;
11722  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
11723  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
11724  int __pyx_v_nDOF_test_element;
11725  PyArrayObject *__pyx_v_q_u = 0;
11726  PyArrayObject *__pyx_v_q_grad_u = 0;
11727  PyArrayObject *__pyx_v_q_grad_w = 0;
11728  PyArrayObject *__pyx_v_q_detJ = 0;
11729  PyArrayObject *__pyx_v_q_m = 0;
11730  PyArrayObject *__pyx_v_q_mt = 0;
11731  PyArrayObject *__pyx_v_q_r = 0;
11732  PyArrayObject *__pyx_v_q_kr = 0;
11733  PyArrayObject *__pyx_v_q_kr_up = 0;
11734  PyArrayObject *__pyx_v_q_flin = 0;
11735  PyArrayObject *__pyx_v_q_alin = 0;
11736  PyArrayObject *__pyx_v_elementResidual = 0;
11737  PyObject *__pyx_r = 0;
11738  __Pyx_RefNannyDeclarations
11739  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual (wrapper)", 0);
11740  {
11741  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_mt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementResidual,0};
11742  PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
11743  if (unlikely(__pyx_kwds)) {
11744  Py_ssize_t kw_args;
11745  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11746  switch (pos_args) {
11747  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11748  CYTHON_FALLTHROUGH;
11749  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11750  CYTHON_FALLTHROUGH;
11751  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11752  CYTHON_FALLTHROUGH;
11753  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11754  CYTHON_FALLTHROUGH;
11755  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11756  CYTHON_FALLTHROUGH;
11757  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11758  CYTHON_FALLTHROUGH;
11759  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11760  CYTHON_FALLTHROUGH;
11761  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11762  CYTHON_FALLTHROUGH;
11763  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11764  CYTHON_FALLTHROUGH;
11765  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11766  CYTHON_FALLTHROUGH;
11767  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11768  CYTHON_FALLTHROUGH;
11769  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11770  CYTHON_FALLTHROUGH;
11771  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11772  CYTHON_FALLTHROUGH;
11773  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11774  CYTHON_FALLTHROUGH;
11775  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11776  CYTHON_FALLTHROUGH;
11777  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11778  CYTHON_FALLTHROUGH;
11779  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11780  CYTHON_FALLTHROUGH;
11781  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11782  CYTHON_FALLTHROUGH;
11783  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11784  CYTHON_FALLTHROUGH;
11785  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11786  CYTHON_FALLTHROUGH;
11787  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11788  CYTHON_FALLTHROUGH;
11789  case 0: break;
11790  default: goto __pyx_L5_argtuple_error;
11791  }
11792  kw_args = PyDict_Size(__pyx_kwds);
11793  switch (pos_args) {
11794  case 0:
11795  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
11796  else goto __pyx_L5_argtuple_error;
11797  CYTHON_FALLTHROUGH;
11798  case 1:
11799  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
11800  else {
11801  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 1); __PYX_ERR(0, 486, __pyx_L3_error)
11802  }
11803  CYTHON_FALLTHROUGH;
11804  case 2:
11805  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
11806  else {
11807  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 2); __PYX_ERR(0, 486, __pyx_L3_error)
11808  }
11809  CYTHON_FALLTHROUGH;
11810  case 3:
11811  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
11812  else {
11813  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 3); __PYX_ERR(0, 486, __pyx_L3_error)
11814  }
11815  CYTHON_FALLTHROUGH;
11816  case 4:
11817  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
11818  else {
11819  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 4); __PYX_ERR(0, 486, __pyx_L3_error)
11820  }
11821  CYTHON_FALLTHROUGH;
11822  case 5:
11823  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
11824  else {
11825  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 5); __PYX_ERR(0, 486, __pyx_L3_error)
11826  }
11827  CYTHON_FALLTHROUGH;
11828  case 6:
11829  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
11830  else {
11831  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 6); __PYX_ERR(0, 486, __pyx_L3_error)
11832  }
11833  CYTHON_FALLTHROUGH;
11834  case 7:
11835  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
11836  else {
11837  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 7); __PYX_ERR(0, 486, __pyx_L3_error)
11838  }
11839  CYTHON_FALLTHROUGH;
11840  case 8:
11841  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
11842  else {
11843  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 8); __PYX_ERR(0, 486, __pyx_L3_error)
11844  }
11845  CYTHON_FALLTHROUGH;
11846  case 9:
11847  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
11848  else {
11849  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 9); __PYX_ERR(0, 486, __pyx_L3_error)
11850  }
11851  CYTHON_FALLTHROUGH;
11852  case 10:
11853  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
11854  else {
11855  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 10); __PYX_ERR(0, 486, __pyx_L3_error)
11856  }
11857  CYTHON_FALLTHROUGH;
11858  case 11:
11859  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
11860  else {
11861  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 11); __PYX_ERR(0, 486, __pyx_L3_error)
11862  }
11863  CYTHON_FALLTHROUGH;
11864  case 12:
11865  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
11866  else {
11867  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 12); __PYX_ERR(0, 486, __pyx_L3_error)
11868  }
11869  CYTHON_FALLTHROUGH;
11870  case 13:
11871  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
11872  else {
11873  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 13); __PYX_ERR(0, 486, __pyx_L3_error)
11874  }
11875  CYTHON_FALLTHROUGH;
11876  case 14:
11877  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
11878  else {
11879  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 14); __PYX_ERR(0, 486, __pyx_L3_error)
11880  }
11881  CYTHON_FALLTHROUGH;
11882  case 15:
11883  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
11884  else {
11885  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 15); __PYX_ERR(0, 486, __pyx_L3_error)
11886  }
11887  CYTHON_FALLTHROUGH;
11888  case 16:
11889  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
11890  else {
11891  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 16); __PYX_ERR(0, 486, __pyx_L3_error)
11892  }
11893  CYTHON_FALLTHROUGH;
11894  case 17:
11895  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
11896  else {
11897  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 17); __PYX_ERR(0, 486, __pyx_L3_error)
11898  }
11899  CYTHON_FALLTHROUGH;
11900  case 18:
11901  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
11902  else {
11903  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 18); __PYX_ERR(0, 486, __pyx_L3_error)
11904  }
11905  CYTHON_FALLTHROUGH;
11906  case 19:
11907  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
11908  else {
11909  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 19); __PYX_ERR(0, 486, __pyx_L3_error)
11910  }
11911  CYTHON_FALLTHROUGH;
11912  case 20:
11913  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementResidual)) != 0)) kw_args--;
11914  else {
11915  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 20); __PYX_ERR(0, 486, __pyx_L3_error)
11916  }
11917  }
11918  if (unlikely(kw_args > 0)) {
11919  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementResidual") < 0)) __PYX_ERR(0, 486, __pyx_L3_error)
11920  }
11921  } else if (PyTuple_GET_SIZE(__pyx_args) != 21) {
11922  goto __pyx_L5_argtuple_error;
11923  } else {
11924  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11925  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11926  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11927  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11928  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11929  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11930  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11931  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11932  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11933  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11934  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11935  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11936  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11937  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11938  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11939  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11940  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11941  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11942  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11943  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11944  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11945  }
11946  __pyx_v_gravity = ((PyArrayObject *)values[0]);
11947  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
11948  __pyx_v_colind = ((PyArrayObject *)values[2]);
11949  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L3_error)
11950  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L3_error)
11951  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 492, __pyx_L3_error)
11952  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
11953  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
11954  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L3_error)
11955  __pyx_v_q_u = ((PyArrayObject *)values[9]);
11956  __pyx_v_q_grad_u = ((PyArrayObject *)values[10]);
11957  __pyx_v_q_grad_w = ((PyArrayObject *)values[11]);
11958  __pyx_v_q_detJ = ((PyArrayObject *)values[12]);
11959  __pyx_v_q_m = ((PyArrayObject *)values[13]);
11960  __pyx_v_q_mt = ((PyArrayObject *)values[14]);
11961  __pyx_v_q_r = ((PyArrayObject *)values[15]);
11962  __pyx_v_q_kr = ((PyArrayObject *)values[16]);
11963  __pyx_v_q_kr_up = ((PyArrayObject *)values[17]);
11964  __pyx_v_q_flin = ((PyArrayObject *)values[18]);
11965  __pyx_v_q_alin = ((PyArrayObject *)values[19]);
11966  __pyx_v_elementResidual = ((PyArrayObject *)values[20]);
11967  }
11968  goto __pyx_L4_argument_unpacking_done;
11969  __pyx_L5_argtuple_error:;
11970  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 486, __pyx_L3_error)
11971  __pyx_L3_error:;
11972  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
11973  __Pyx_RefNannyFinishContext();
11974  return NULL;
11975  __pyx_L4_argument_unpacking_done:;
11976  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 486, __pyx_L1_error)
11977  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 487, __pyx_L1_error)
11978  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 488, __pyx_L1_error)
11979  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 493, __pyx_L1_error)
11980  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 494, __pyx_L1_error)
11981  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 497, __pyx_L1_error)
11982  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 498, __pyx_L1_error)
11983  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 499, __pyx_L1_error)
11984  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 501, __pyx_L1_error)
11985  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 502, __pyx_L1_error)
11986  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 503, __pyx_L1_error)
11987  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 504, __pyx_L1_error)
11988  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 505, __pyx_L1_error)
11989  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 506, __pyx_L1_error)
11990  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 509, __pyx_L1_error)
11991  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 510, __pyx_L1_error)
11992  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementResidual), __pyx_ptype_5numpy_ndarray, 1, "elementResidual", 0))) __PYX_ERR(0, 512, __pyx_L1_error)
11993  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_mt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementResidual);
11994 
11995  /* function exit code */
11996  goto __pyx_L0;
11997  __pyx_L1_error:;
11998  __pyx_r = NULL;
11999  __pyx_L0:;
12000  __Pyx_RefNannyFinishContext();
12001  return __pyx_r;
12002 }
12003 
12004 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual) {
12005  CYTHON_UNUSED int __pyx_v_upwindFlag;
12006  PyObject *__pyx_v_q = NULL;
12007  int __pyx_v_nnz;
12008  int __pyx_v_eN;
12009  int __pyx_v_ii;
12010  int __pyx_v_I;
12011  int __pyx_v_i;
12012  int __pyx_v_ebN;
12013  PyArrayObject *__pyx_v_a_up = 0;
12014  PyArrayObject *__pyx_v_f_up = 0;
12015  double __pyx_v_nAvgWeight;
12016  double __pyx_v_weight;
12017  double __pyx_v_volFactor;
12018  double __pyx_v_volume;
12019  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
12020  __Pyx_Buffer __pyx_pybuffer_a_up;
12021  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
12022  __Pyx_Buffer __pyx_pybuffer_colind;
12023  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
12024  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
12025  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
12026  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
12027  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementResidual;
12028  __Pyx_Buffer __pyx_pybuffer_elementResidual;
12029  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
12030  __Pyx_Buffer __pyx_pybuffer_f_up;
12031  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
12032  __Pyx_Buffer __pyx_pybuffer_gravity;
12033  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
12034  __Pyx_Buffer __pyx_pybuffer_q_alin;
12035  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
12036  __Pyx_Buffer __pyx_pybuffer_q_detJ;
12037  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
12038  __Pyx_Buffer __pyx_pybuffer_q_flin;
12039  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
12040  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
12041  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
12042  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
12043  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
12044  __Pyx_Buffer __pyx_pybuffer_q_kr;
12045  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
12046  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
12047  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
12048  __Pyx_Buffer __pyx_pybuffer_q_m;
12049  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
12050  __Pyx_Buffer __pyx_pybuffer_q_mt;
12051  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
12052  __Pyx_Buffer __pyx_pybuffer_q_r;
12053  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
12054  __Pyx_Buffer __pyx_pybuffer_q_u;
12055  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
12056  __Pyx_Buffer __pyx_pybuffer_rowptr;
12057  PyObject *__pyx_r = NULL;
12058  __Pyx_RefNannyDeclarations
12059  PyObject *__pyx_t_1 = NULL;
12060  PyObject *__pyx_t_2 = NULL;
12061  Py_ssize_t __pyx_t_3;
12062  PyObject *__pyx_t_4 = NULL;
12063  PyObject *__pyx_t_5 = NULL;
12064  int __pyx_t_6;
12065  Py_ssize_t __pyx_t_7;
12066  int __pyx_t_8;
12067  PyObject *__pyx_t_9 = NULL;
12068  PyArrayObject *__pyx_t_10 = NULL;
12069  PyArrayObject *__pyx_t_11 = NULL;
12070  double __pyx_t_12;
12071  int __pyx_t_13;
12072  int __pyx_t_14;
12073  Py_ssize_t __pyx_t_15;
12074  Py_ssize_t __pyx_t_16;
12075  int __pyx_t_17;
12076  int __pyx_t_18;
12077  int __pyx_t_19;
12078  Py_ssize_t __pyx_t_20;
12079  Py_ssize_t __pyx_t_21;
12080  int __pyx_t_22;
12081  Py_ssize_t __pyx_t_23;
12082  Py_ssize_t __pyx_t_24;
12083  Py_ssize_t __pyx_t_25;
12084  Py_ssize_t __pyx_t_26;
12085  Py_ssize_t __pyx_t_27;
12086  Py_ssize_t __pyx_t_28;
12087  int __pyx_t_29;
12088  int __pyx_t_30;
12089  int __pyx_t_31;
12090  int __pyx_t_32;
12091  int __pyx_t_33;
12092  Py_ssize_t __pyx_t_34;
12093  Py_ssize_t __pyx_t_35;
12094  Py_ssize_t __pyx_t_36;
12095  int __pyx_t_37;
12096  Py_ssize_t __pyx_t_38;
12097  Py_ssize_t __pyx_t_39;
12098  Py_ssize_t __pyx_t_40;
12099  Py_ssize_t __pyx_t_41;
12100  Py_ssize_t __pyx_t_42;
12101  Py_ssize_t __pyx_t_43;
12102  Py_ssize_t __pyx_t_44;
12103  Py_ssize_t __pyx_t_45;
12104  Py_ssize_t __pyx_t_46;
12105  Py_ssize_t __pyx_t_47;
12106  Py_ssize_t __pyx_t_48;
12107  Py_ssize_t __pyx_t_49;
12108  Py_ssize_t __pyx_t_50;
12109  Py_ssize_t __pyx_t_51;
12110  Py_ssize_t __pyx_t_52;
12111  Py_ssize_t __pyx_t_53;
12112  Py_ssize_t __pyx_t_54;
12113  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_55;
12114  Py_ssize_t __pyx_t_56;
12115  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_57;
12116  Py_ssize_t __pyx_t_58;
12117  int __pyx_t_59;
12118  Py_ssize_t __pyx_t_60;
12119  Py_ssize_t __pyx_t_61;
12120  Py_ssize_t __pyx_t_62;
12121  Py_ssize_t __pyx_t_63;
12122  Py_ssize_t __pyx_t_64;
12123  Py_ssize_t __pyx_t_65;
12124  Py_ssize_t __pyx_t_66;
12125  Py_ssize_t __pyx_t_67;
12126  Py_ssize_t __pyx_t_68;
12127  Py_ssize_t __pyx_t_69;
12128  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual", 0);
12129  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
12130  __pyx_pybuffer_a_up.refcount = 0;
12131  __pyx_pybuffernd_a_up.data = NULL;
12132  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
12133  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
12134  __pyx_pybuffer_f_up.refcount = 0;
12135  __pyx_pybuffernd_f_up.data = NULL;
12136  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
12137  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
12138  __pyx_pybuffer_gravity.refcount = 0;
12139  __pyx_pybuffernd_gravity.data = NULL;
12140  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
12141  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
12142  __pyx_pybuffer_rowptr.refcount = 0;
12143  __pyx_pybuffernd_rowptr.data = NULL;
12144  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
12145  __pyx_pybuffer_colind.pybuffer.buf = NULL;
12146  __pyx_pybuffer_colind.refcount = 0;
12147  __pyx_pybuffernd_colind.data = NULL;
12148  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
12149  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
12150  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
12151  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
12152  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
12153  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
12154  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
12155  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
12156  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
12157  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
12158  __pyx_pybuffer_q_u.refcount = 0;
12159  __pyx_pybuffernd_q_u.data = NULL;
12160  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
12161  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
12162  __pyx_pybuffer_q_grad_u.refcount = 0;
12163  __pyx_pybuffernd_q_grad_u.data = NULL;
12164  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
12165  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
12166  __pyx_pybuffer_q_grad_w.refcount = 0;
12167  __pyx_pybuffernd_q_grad_w.data = NULL;
12168  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
12169  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
12170  __pyx_pybuffer_q_detJ.refcount = 0;
12171  __pyx_pybuffernd_q_detJ.data = NULL;
12172  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
12173  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
12174  __pyx_pybuffer_q_m.refcount = 0;
12175  __pyx_pybuffernd_q_m.data = NULL;
12176  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
12177  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
12178  __pyx_pybuffer_q_mt.refcount = 0;
12179  __pyx_pybuffernd_q_mt.data = NULL;
12180  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
12181  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
12182  __pyx_pybuffer_q_r.refcount = 0;
12183  __pyx_pybuffernd_q_r.data = NULL;
12184  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
12185  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
12186  __pyx_pybuffer_q_kr.refcount = 0;
12187  __pyx_pybuffernd_q_kr.data = NULL;
12188  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
12189  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
12190  __pyx_pybuffer_q_kr_up.refcount = 0;
12191  __pyx_pybuffernd_q_kr_up.data = NULL;
12192  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
12193  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
12194  __pyx_pybuffer_q_flin.refcount = 0;
12195  __pyx_pybuffernd_q_flin.data = NULL;
12196  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
12197  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
12198  __pyx_pybuffer_q_alin.refcount = 0;
12199  __pyx_pybuffernd_q_alin.data = NULL;
12200  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
12201  __pyx_pybuffer_elementResidual.pybuffer.buf = NULL;
12202  __pyx_pybuffer_elementResidual.refcount = 0;
12203  __pyx_pybuffernd_elementResidual.data = NULL;
12204  __pyx_pybuffernd_elementResidual.rcbuffer = &__pyx_pybuffer_elementResidual;
12205  {
12206  __Pyx_BufFmt_StackElem __pyx_stack[1];
12207  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12208  }
12209  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
12210  {
12211  __Pyx_BufFmt_StackElem __pyx_stack[1];
12212  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12213  }
12214  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
12215  {
12216  __Pyx_BufFmt_StackElem __pyx_stack[1];
12217  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12218  }
12219  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
12220  {
12221  __Pyx_BufFmt_StackElem __pyx_stack[1];
12222  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12223  }
12224  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
12225  {
12226  __Pyx_BufFmt_StackElem __pyx_stack[1];
12227  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12228  }
12229  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
12230  {
12231  __Pyx_BufFmt_StackElem __pyx_stack[1];
12232  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12233  }
12234  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
12235  {
12236  __Pyx_BufFmt_StackElem __pyx_stack[1];
12237  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12238  }
12239  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
12240  {
12241  __Pyx_BufFmt_StackElem __pyx_stack[1];
12242  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12243  }
12244  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
12245  {
12246  __Pyx_BufFmt_StackElem __pyx_stack[1];
12247  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12248  }
12249  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
12250  {
12251  __Pyx_BufFmt_StackElem __pyx_stack[1];
12252  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12253  }
12254  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
12255  {
12256  __Pyx_BufFmt_StackElem __pyx_stack[1];
12257  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12258  }
12259  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
12260  {
12261  __Pyx_BufFmt_StackElem __pyx_stack[1];
12262  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12263  }
12264  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
12265  {
12266  __Pyx_BufFmt_StackElem __pyx_stack[1];
12267  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12268  }
12269  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
12270  {
12271  __Pyx_BufFmt_StackElem __pyx_stack[1];
12272  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12273  }
12274  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
12275  {
12276  __Pyx_BufFmt_StackElem __pyx_stack[1];
12277  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12278  }
12279  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
12280  {
12281  __Pyx_BufFmt_StackElem __pyx_stack[1];
12282  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12283  }
12284  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
12285  {
12286  __Pyx_BufFmt_StackElem __pyx_stack[1];
12287  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementResidual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12288  }
12289  __pyx_pybuffernd_elementResidual.diminfo[0].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementResidual.diminfo[0].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementResidual.diminfo[1].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementResidual.diminfo[1].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[1];
12290 
12291  /* "subsurfaceTransportFunctions.pyx":527
12292  *
12293  * """
12294  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
12295  * #check some sizes
12296  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12297  */
12298  __pyx_v_upwindFlag = 1;
12299 
12300  /* "subsurfaceTransportFunctions.pyx":529
12301  * cdef int upwindFlag = 1
12302  * #check some sizes
12303  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12304  * assert q.shape[1] == nSpace+1
12305  * assert nDOF_test_element == nSpace+1
12306  */
12307  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
12308  __Pyx_GOTREF(__pyx_t_1);
12309  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
12310  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
12311  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
12312  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
12313  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
12314  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
12315  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
12316  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
12317  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
12318  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
12319  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
12320  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
12321  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
12322  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
12323  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
12324  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
12325  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12326  for (;;) {
12327  if (__pyx_t_3 >= 5) break;
12328  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12329  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 529, __pyx_L1_error)
12330  #else
12331  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
12332  __Pyx_GOTREF(__pyx_t_1);
12333  #endif
12334  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
12335  __pyx_t_1 = 0;
12336 
12337  /* "subsurfaceTransportFunctions.pyx":530
12338  * #check some sizes
12339  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12340  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
12341  * assert nDOF_test_element == nSpace+1
12342  * cdef int nnz = rowptr[nSpace]
12343  */
12344  #ifndef CYTHON_WITHOUT_ASSERTIONS
12345  if (unlikely(!Py_OptimizeFlag)) {
12346  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
12347  __Pyx_GOTREF(__pyx_t_1);
12348  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error)
12349  __Pyx_GOTREF(__pyx_t_4);
12350  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12351  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
12352  __Pyx_GOTREF(__pyx_t_1);
12353  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error)
12354  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12355  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12356  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 530, __pyx_L1_error)
12357  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12358  if (unlikely(!__pyx_t_6)) {
12359  PyErr_SetNone(PyExc_AssertionError);
12360  __PYX_ERR(0, 530, __pyx_L1_error)
12361  }
12362  }
12363  #endif
12364 
12365  /* "subsurfaceTransportFunctions.pyx":529
12366  * cdef int upwindFlag = 1
12367  * #check some sizes
12368  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12369  * assert q.shape[1] == nSpace+1
12370  * assert nDOF_test_element == nSpace+1
12371  */
12372  }
12373  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12374 
12375  /* "subsurfaceTransportFunctions.pyx":531
12376  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12377  * assert q.shape[1] == nSpace+1
12378  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
12379  * cdef int nnz = rowptr[nSpace]
12380  * #temporaries
12381  */
12382  #ifndef CYTHON_WITHOUT_ASSERTIONS
12383  if (unlikely(!Py_OptimizeFlag)) {
12384  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
12385  PyErr_SetNone(PyExc_AssertionError);
12386  __PYX_ERR(0, 531, __pyx_L1_error)
12387  }
12388  }
12389  #endif
12390 
12391  /* "subsurfaceTransportFunctions.pyx":532
12392  * assert q.shape[1] == nSpace+1
12393  * assert nDOF_test_element == nSpace+1
12394  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
12395  * #temporaries
12396  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
12397  */
12398  __pyx_t_7 = __pyx_v_nSpace;
12399  __pyx_t_8 = -1;
12400  if (__pyx_t_7 < 0) {
12401  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12402  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
12403  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
12404  if (unlikely(__pyx_t_8 != -1)) {
12405  __Pyx_RaiseBufferIndexError(__pyx_t_8);
12406  __PYX_ERR(0, 532, __pyx_L1_error)
12407  }
12408  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
12409 
12410  /* "subsurfaceTransportFunctions.pyx":536
12411  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
12412  * cdef int eN,eN_neighbor,ii,I,i,ebN
12413  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
12414  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12415  * #for averaging/integration weights
12416  */
12417  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
12418  __Pyx_GOTREF(__pyx_t_5);
12419  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
12420  __Pyx_GOTREF(__pyx_t_1);
12421  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12422  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
12423  __Pyx_GOTREF(__pyx_t_5);
12424  __pyx_t_4 = NULL;
12425  __pyx_t_8 = 0;
12426  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
12427  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
12428  if (likely(__pyx_t_4)) {
12429  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
12430  __Pyx_INCREF(__pyx_t_4);
12431  __Pyx_INCREF(function);
12432  __Pyx_DECREF_SET(__pyx_t_1, function);
12433  __pyx_t_8 = 1;
12434  }
12435  }
12436  #if CYTHON_FAST_PYCALL
12437  if (PyFunction_Check(__pyx_t_1)) {
12438  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
12439  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12440  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12441  __Pyx_GOTREF(__pyx_t_2);
12442  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12443  } else
12444  #endif
12445  #if CYTHON_FAST_PYCCALL
12446  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
12447  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
12448  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12449  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12450  __Pyx_GOTREF(__pyx_t_2);
12451  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12452  } else
12453  #endif
12454  {
12455  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 536, __pyx_L1_error)
12456  __Pyx_GOTREF(__pyx_t_9);
12457  if (__pyx_t_4) {
12458  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
12459  }
12460  __Pyx_GIVEREF(__pyx_t_5);
12461  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
12462  __Pyx_INCREF(__pyx_n_s_d);
12463  __Pyx_GIVEREF(__pyx_n_s_d);
12464  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
12465  __pyx_t_5 = 0;
12466  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12467  __Pyx_GOTREF(__pyx_t_2);
12468  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12469  }
12470  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12471  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 536, __pyx_L1_error)
12472  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
12473  {
12474  __Pyx_BufFmt_StackElem __pyx_stack[1];
12475  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12476  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
12477  __PYX_ERR(0, 536, __pyx_L1_error)
12478  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
12479  }
12480  }
12481  __pyx_t_10 = 0;
12482  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
12483  __pyx_t_2 = 0;
12484 
12485  /* "subsurfaceTransportFunctions.pyx":537
12486  * cdef int eN,eN_neighbor,ii,I,i,ebN
12487  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
12488  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
12489  * #for averaging/integration weights
12490  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12491  */
12492  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
12493  __Pyx_GOTREF(__pyx_t_1);
12494  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 537, __pyx_L1_error)
12495  __Pyx_GOTREF(__pyx_t_9);
12496  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12497  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
12498  __Pyx_GOTREF(__pyx_t_1);
12499  __pyx_t_5 = NULL;
12500  __pyx_t_8 = 0;
12501  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
12502  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
12503  if (likely(__pyx_t_5)) {
12504  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
12505  __Pyx_INCREF(__pyx_t_5);
12506  __Pyx_INCREF(function);
12507  __Pyx_DECREF_SET(__pyx_t_9, function);
12508  __pyx_t_8 = 1;
12509  }
12510  }
12511  #if CYTHON_FAST_PYCALL
12512  if (PyFunction_Check(__pyx_t_9)) {
12513  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12514  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12515  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12516  __Pyx_GOTREF(__pyx_t_2);
12517  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12518  } else
12519  #endif
12520  #if CYTHON_FAST_PYCCALL
12521  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
12522  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12523  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12524  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12525  __Pyx_GOTREF(__pyx_t_2);
12526  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12527  } else
12528  #endif
12529  {
12530  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error)
12531  __Pyx_GOTREF(__pyx_t_4);
12532  if (__pyx_t_5) {
12533  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
12534  }
12535  __Pyx_GIVEREF(__pyx_t_1);
12536  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
12537  __Pyx_INCREF(__pyx_n_s_d);
12538  __Pyx_GIVEREF(__pyx_n_s_d);
12539  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
12540  __pyx_t_1 = 0;
12541  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12542  __Pyx_GOTREF(__pyx_t_2);
12543  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12544  }
12545  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12546  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 537, __pyx_L1_error)
12547  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
12548  {
12549  __Pyx_BufFmt_StackElem __pyx_stack[1];
12550  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12551  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
12552  __PYX_ERR(0, 537, __pyx_L1_error)
12553  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
12554  }
12555  }
12556  __pyx_t_11 = 0;
12557  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
12558  __pyx_t_2 = 0;
12559 
12560  /* "subsurfaceTransportFunctions.pyx":539
12561  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12562  * #for averaging/integration weights
12563  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
12564  * cdef double weight=1.0,volFactor = 1.0
12565  * if nSpace == 2:
12566  */
12567  __pyx_t_12 = (__pyx_v_nSpace + 1.);
12568  if (unlikely(__pyx_t_12 == 0)) {
12569  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
12570  __PYX_ERR(0, 539, __pyx_L1_error)
12571  }
12572  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
12573 
12574  /* "subsurfaceTransportFunctions.pyx":540
12575  * #for averaging/integration weights
12576  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12577  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
12578  * if nSpace == 2:
12579  * volFactor = 0.5
12580  */
12581  __pyx_v_weight = 1.0;
12582  __pyx_v_volFactor = 1.0;
12583 
12584  /* "subsurfaceTransportFunctions.pyx":541
12585  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12586  * cdef double weight=1.0,volFactor = 1.0
12587  * if nSpace == 2: # <<<<<<<<<<<<<<
12588  * volFactor = 0.5
12589  * if nSpace == 3:
12590  */
12591  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
12592  if (__pyx_t_6) {
12593 
12594  /* "subsurfaceTransportFunctions.pyx":542
12595  * cdef double weight=1.0,volFactor = 1.0
12596  * if nSpace == 2:
12597  * volFactor = 0.5 # <<<<<<<<<<<<<<
12598  * if nSpace == 3:
12599  * volFactor = 1.0/6.0
12600  */
12601  __pyx_v_volFactor = 0.5;
12602 
12603  /* "subsurfaceTransportFunctions.pyx":541
12604  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12605  * cdef double weight=1.0,volFactor = 1.0
12606  * if nSpace == 2: # <<<<<<<<<<<<<<
12607  * volFactor = 0.5
12608  * if nSpace == 3:
12609  */
12610  }
12611 
12612  /* "subsurfaceTransportFunctions.pyx":543
12613  * if nSpace == 2:
12614  * volFactor = 0.5
12615  * if nSpace == 3: # <<<<<<<<<<<<<<
12616  * volFactor = 1.0/6.0
12617  * #
12618  */
12619  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
12620  if (__pyx_t_6) {
12621 
12622  /* "subsurfaceTransportFunctions.pyx":544
12623  * volFactor = 0.5
12624  * if nSpace == 3:
12625  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
12626  * #
12627  * for eN in range(nElements_global):
12628  */
12629  __pyx_v_volFactor = (1.0 / 6.0);
12630 
12631  /* "subsurfaceTransportFunctions.pyx":543
12632  * if nSpace == 2:
12633  * volFactor = 0.5
12634  * if nSpace == 3: # <<<<<<<<<<<<<<
12635  * volFactor = 1.0/6.0
12636  * #
12637  */
12638  }
12639 
12640  /* "subsurfaceTransportFunctions.pyx":546
12641  * volFactor = 1.0/6.0
12642  * #
12643  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
12644  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12645  * weight = nAvgWeight*volume
12646  */
12647  __pyx_t_8 = __pyx_v_nElements_global;
12648  __pyx_t_13 = __pyx_t_8;
12649  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
12650  __pyx_v_eN = __pyx_t_14;
12651 
12652  /* "subsurfaceTransportFunctions.pyx":547
12653  * #
12654  * for eN in range(nElements_global):
12655  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
12656  * weight = nAvgWeight*volume
12657  *
12658  */
12659  __pyx_t_15 = __pyx_v_eN;
12660  __pyx_t_16 = 0;
12661  __pyx_t_17 = -1;
12662  if (__pyx_t_15 < 0) {
12663  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
12664  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0;
12665  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_17 = 0;
12666  if (__pyx_t_16 < 0) {
12667  __pyx_t_16 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
12668  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
12669  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_17 = 1;
12670  if (unlikely(__pyx_t_17 != -1)) {
12671  __Pyx_RaiseBufferIndexError(__pyx_t_17);
12672  __PYX_ERR(0, 547, __pyx_L1_error)
12673  }
12674  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
12675 
12676  /* "subsurfaceTransportFunctions.pyx":548
12677  * for eN in range(nElements_global):
12678  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12679  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
12680  *
12681  * for i in range(nDOF_test_element):
12682  */
12683  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
12684 
12685  /* "subsurfaceTransportFunctions.pyx":550
12686  * weight = nAvgWeight*volume
12687  *
12688  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
12689  * #nodal quadrature so diagonal
12690  * ##mass
12691  */
12692  __pyx_t_17 = __pyx_v_nDOF_test_element;
12693  __pyx_t_18 = __pyx_t_17;
12694  for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
12695  __pyx_v_i = __pyx_t_19;
12696 
12697  /* "subsurfaceTransportFunctions.pyx":553
12698  * #nodal quadrature so diagonal
12699  * ##mass
12700  * elementResidual[eN,i] += weight*q_mt[eN,i] # <<<<<<<<<<<<<<
12701  * ##sources
12702  * elementResidual[eN,i] += weight*q_r[eN,i]
12703  */
12704  __pyx_t_20 = __pyx_v_eN;
12705  __pyx_t_21 = __pyx_v_i;
12706  __pyx_t_22 = -1;
12707  if (__pyx_t_20 < 0) {
12708  __pyx_t_20 += __pyx_pybuffernd_q_mt.diminfo[0].shape;
12709  if (unlikely(__pyx_t_20 < 0)) __pyx_t_22 = 0;
12710  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_mt.diminfo[0].shape)) __pyx_t_22 = 0;
12711  if (__pyx_t_21 < 0) {
12712  __pyx_t_21 += __pyx_pybuffernd_q_mt.diminfo[1].shape;
12713  if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 1;
12714  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_mt.diminfo[1].shape)) __pyx_t_22 = 1;
12715  if (unlikely(__pyx_t_22 != -1)) {
12716  __Pyx_RaiseBufferIndexError(__pyx_t_22);
12717  __PYX_ERR(0, 553, __pyx_L1_error)
12718  }
12719  __pyx_t_23 = __pyx_v_eN;
12720  __pyx_t_24 = __pyx_v_i;
12721  __pyx_t_22 = -1;
12722  if (__pyx_t_23 < 0) {
12723  __pyx_t_23 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12724  if (unlikely(__pyx_t_23 < 0)) __pyx_t_22 = 0;
12725  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_22 = 0;
12726  if (__pyx_t_24 < 0) {
12727  __pyx_t_24 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12728  if (unlikely(__pyx_t_24 < 0)) __pyx_t_22 = 1;
12729  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_22 = 1;
12730  if (unlikely(__pyx_t_22 != -1)) {
12731  __Pyx_RaiseBufferIndexError(__pyx_t_22);
12732  __PYX_ERR(0, 553, __pyx_L1_error)
12733  }
12734  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_q_mt.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_q_mt.diminfo[1].strides)));
12735 
12736  /* "subsurfaceTransportFunctions.pyx":555
12737  * elementResidual[eN,i] += weight*q_mt[eN,i]
12738  * ##sources
12739  * elementResidual[eN,i] += weight*q_r[eN,i] # <<<<<<<<<<<<<<
12740  *
12741  * #have to actually compute loop over other nodes for stiffness terms
12742  */
12743  __pyx_t_25 = __pyx_v_eN;
12744  __pyx_t_26 = __pyx_v_i;
12745  __pyx_t_22 = -1;
12746  if (__pyx_t_25 < 0) {
12747  __pyx_t_25 += __pyx_pybuffernd_q_r.diminfo[0].shape;
12748  if (unlikely(__pyx_t_25 < 0)) __pyx_t_22 = 0;
12749  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_q_r.diminfo[0].shape)) __pyx_t_22 = 0;
12750  if (__pyx_t_26 < 0) {
12751  __pyx_t_26 += __pyx_pybuffernd_q_r.diminfo[1].shape;
12752  if (unlikely(__pyx_t_26 < 0)) __pyx_t_22 = 1;
12753  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_q_r.diminfo[1].shape)) __pyx_t_22 = 1;
12754  if (unlikely(__pyx_t_22 != -1)) {
12755  __Pyx_RaiseBufferIndexError(__pyx_t_22);
12756  __PYX_ERR(0, 555, __pyx_L1_error)
12757  }
12758  __pyx_t_27 = __pyx_v_eN;
12759  __pyx_t_28 = __pyx_v_i;
12760  __pyx_t_22 = -1;
12761  if (__pyx_t_27 < 0) {
12762  __pyx_t_27 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12763  if (unlikely(__pyx_t_27 < 0)) __pyx_t_22 = 0;
12764  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_22 = 0;
12765  if (__pyx_t_28 < 0) {
12766  __pyx_t_28 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12767  if (unlikely(__pyx_t_28 < 0)) __pyx_t_22 = 1;
12768  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_22 = 1;
12769  if (unlikely(__pyx_t_22 != -1)) {
12770  __Pyx_RaiseBufferIndexError(__pyx_t_22);
12771  __PYX_ERR(0, 555, __pyx_L1_error)
12772  }
12773  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_r.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_q_r.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_q_r.diminfo[1].strides)));
12774 
12775  /* "subsurfaceTransportFunctions.pyx":558
12776  *
12777  * #have to actually compute loop over other nodes for stiffness terms
12778  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
12779  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12780  * for ii in range(nnz):
12781  */
12782  __pyx_t_22 = __pyx_v_nElementBoundaries_element;
12783  __pyx_t_29 = __pyx_t_22;
12784  for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) {
12785  __pyx_v_ebN = __pyx_t_30;
12786 
12787  /* "subsurfaceTransportFunctions.pyx":560
12788  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
12789  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12790  * for ii in range(nnz): # <<<<<<<<<<<<<<
12791  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12792  * for I in range(nSpace):
12793  */
12794  __pyx_t_31 = __pyx_v_nnz;
12795  __pyx_t_32 = __pyx_t_31;
12796  for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) {
12797  __pyx_v_ii = __pyx_t_33;
12798 
12799  /* "subsurfaceTransportFunctions.pyx":561
12800  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12801  * for ii in range(nnz):
12802  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12803  * for I in range(nSpace):
12804  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12805  */
12806  __pyx_t_34 = __pyx_v_eN;
12807  __pyx_t_35 = __pyx_v_ebN;
12808  __pyx_t_36 = __pyx_v_ii;
12809  __pyx_t_37 = -1;
12810  if (__pyx_t_34 < 0) {
12811  __pyx_t_34 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
12812  if (unlikely(__pyx_t_34 < 0)) __pyx_t_37 = 0;
12813  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_37 = 0;
12814  if (__pyx_t_35 < 0) {
12815  __pyx_t_35 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
12816  if (unlikely(__pyx_t_35 < 0)) __pyx_t_37 = 1;
12817  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_37 = 1;
12818  if (__pyx_t_36 < 0) {
12819  __pyx_t_36 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
12820  if (unlikely(__pyx_t_36 < 0)) __pyx_t_37 = 2;
12821  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_37 = 2;
12822  if (unlikely(__pyx_t_37 != -1)) {
12823  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12824  __PYX_ERR(0, 561, __pyx_L1_error)
12825  }
12826  __pyx_t_38 = __pyx_v_eN;
12827  __pyx_t_39 = __pyx_v_ebN;
12828  __pyx_t_37 = -1;
12829  if (__pyx_t_38 < 0) {
12830  __pyx_t_38 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12831  if (unlikely(__pyx_t_38 < 0)) __pyx_t_37 = 0;
12832  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_37 = 0;
12833  if (__pyx_t_39 < 0) {
12834  __pyx_t_39 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12835  if (unlikely(__pyx_t_39 < 0)) __pyx_t_37 = 1;
12836  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_37 = 1;
12837  if (unlikely(__pyx_t_37 != -1)) {
12838  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12839  __PYX_ERR(0, 561, __pyx_L1_error)
12840  }
12841  __pyx_t_40 = __pyx_v_ii;
12842  __pyx_t_37 = -1;
12843  if (__pyx_t_40 < 0) {
12844  __pyx_t_40 += __pyx_pybuffernd_a_up.diminfo[0].shape;
12845  if (unlikely(__pyx_t_40 < 0)) __pyx_t_37 = 0;
12846  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_37 = 0;
12847  if (unlikely(__pyx_t_37 != -1)) {
12848  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12849  __PYX_ERR(0, 561, __pyx_L1_error)
12850  }
12851  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_36, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12852  }
12853 
12854  /* "subsurfaceTransportFunctions.pyx":562
12855  * for ii in range(nnz):
12856  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12857  * for I in range(nSpace): # <<<<<<<<<<<<<<
12858  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12859  * #
12860  */
12861  __pyx_t_31 = __pyx_v_nSpace;
12862  __pyx_t_32 = __pyx_t_31;
12863  for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) {
12864  __pyx_v_I = __pyx_t_33;
12865 
12866  /* "subsurfaceTransportFunctions.pyx":563
12867  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12868  * for I in range(nSpace):
12869  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12870  * #
12871  * #accumulate advection and stiffness contributions
12872  */
12873  __pyx_t_41 = __pyx_v_eN;
12874  __pyx_t_42 = __pyx_v_ebN;
12875  __pyx_t_43 = __pyx_v_I;
12876  __pyx_t_37 = -1;
12877  if (__pyx_t_41 < 0) {
12878  __pyx_t_41 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
12879  if (unlikely(__pyx_t_41 < 0)) __pyx_t_37 = 0;
12880  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_37 = 0;
12881  if (__pyx_t_42 < 0) {
12882  __pyx_t_42 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
12883  if (unlikely(__pyx_t_42 < 0)) __pyx_t_37 = 1;
12884  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_37 = 1;
12885  if (__pyx_t_43 < 0) {
12886  __pyx_t_43 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
12887  if (unlikely(__pyx_t_43 < 0)) __pyx_t_37 = 2;
12888  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_37 = 2;
12889  if (unlikely(__pyx_t_37 != -1)) {
12890  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12891  __PYX_ERR(0, 563, __pyx_L1_error)
12892  }
12893  __pyx_t_44 = __pyx_v_eN;
12894  __pyx_t_45 = __pyx_v_ebN;
12895  __pyx_t_37 = -1;
12896  if (__pyx_t_44 < 0) {
12897  __pyx_t_44 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12898  if (unlikely(__pyx_t_44 < 0)) __pyx_t_37 = 0;
12899  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_37 = 0;
12900  if (__pyx_t_45 < 0) {
12901  __pyx_t_45 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12902  if (unlikely(__pyx_t_45 < 0)) __pyx_t_37 = 1;
12903  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_37 = 1;
12904  if (unlikely(__pyx_t_37 != -1)) {
12905  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12906  __PYX_ERR(0, 563, __pyx_L1_error)
12907  }
12908  __pyx_t_46 = __pyx_v_I;
12909  __pyx_t_37 = -1;
12910  if (__pyx_t_46 < 0) {
12911  __pyx_t_46 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12912  if (unlikely(__pyx_t_46 < 0)) __pyx_t_37 = 0;
12913  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_37 = 0;
12914  if (unlikely(__pyx_t_37 != -1)) {
12915  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12916  __PYX_ERR(0, 563, __pyx_L1_error)
12917  }
12918  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_43, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12919  }
12920 
12921  /* "subsurfaceTransportFunctions.pyx":566
12922  * #
12923  * #accumulate advection and stiffness contributions
12924  * for I in range(nSpace): # <<<<<<<<<<<<<<
12925  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12926  * for ii in range(rowptr[I],rowptr[I+1]):
12927  */
12928  __pyx_t_31 = __pyx_v_nSpace;
12929  __pyx_t_32 = __pyx_t_31;
12930  for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) {
12931  __pyx_v_I = __pyx_t_33;
12932 
12933  /* "subsurfaceTransportFunctions.pyx":567
12934  * #accumulate advection and stiffness contributions
12935  * for I in range(nSpace):
12936  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
12937  * for ii in range(rowptr[I],rowptr[I+1]):
12938  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
12939  */
12940  __pyx_t_47 = __pyx_v_I;
12941  __pyx_t_37 = -1;
12942  if (__pyx_t_47 < 0) {
12943  __pyx_t_47 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12944  if (unlikely(__pyx_t_47 < 0)) __pyx_t_37 = 0;
12945  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_37 = 0;
12946  if (unlikely(__pyx_t_37 != -1)) {
12947  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12948  __PYX_ERR(0, 567, __pyx_L1_error)
12949  }
12950  __pyx_t_48 = __pyx_v_eN;
12951  __pyx_t_49 = __pyx_v_ebN;
12952  __pyx_t_50 = __pyx_v_i;
12953  __pyx_t_51 = __pyx_v_I;
12954  __pyx_t_37 = -1;
12955  if (__pyx_t_48 < 0) {
12956  __pyx_t_48 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
12957  if (unlikely(__pyx_t_48 < 0)) __pyx_t_37 = 0;
12958  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_37 = 0;
12959  if (__pyx_t_49 < 0) {
12960  __pyx_t_49 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
12961  if (unlikely(__pyx_t_49 < 0)) __pyx_t_37 = 1;
12962  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_37 = 1;
12963  if (__pyx_t_50 < 0) {
12964  __pyx_t_50 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
12965  if (unlikely(__pyx_t_50 < 0)) __pyx_t_37 = 2;
12966  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_37 = 2;
12967  if (__pyx_t_51 < 0) {
12968  __pyx_t_51 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
12969  if (unlikely(__pyx_t_51 < 0)) __pyx_t_37 = 3;
12970  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_37 = 3;
12971  if (unlikely(__pyx_t_37 != -1)) {
12972  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12973  __PYX_ERR(0, 567, __pyx_L1_error)
12974  }
12975  __pyx_t_52 = __pyx_v_eN;
12976  __pyx_t_53 = __pyx_v_i;
12977  __pyx_t_37 = -1;
12978  if (__pyx_t_52 < 0) {
12979  __pyx_t_52 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12980  if (unlikely(__pyx_t_52 < 0)) __pyx_t_37 = 0;
12981  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_37 = 0;
12982  if (__pyx_t_53 < 0) {
12983  __pyx_t_53 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12984  if (unlikely(__pyx_t_53 < 0)) __pyx_t_37 = 1;
12985  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_37 = 1;
12986  if (unlikely(__pyx_t_37 != -1)) {
12987  __Pyx_RaiseBufferIndexError(__pyx_t_37);
12988  __PYX_ERR(0, 567, __pyx_L1_error)
12989  }
12990  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_elementResidual.diminfo[1].strides) -= ((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_f_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_50, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_51, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
12991 
12992  /* "subsurfaceTransportFunctions.pyx":568
12993  * for I in range(nSpace):
12994  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12995  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
12996  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
12997  * #I
12998  */
12999  __pyx_t_54 = (__pyx_v_I + 1);
13000  __pyx_t_37 = -1;
13001  if (__pyx_t_54 < 0) {
13002  __pyx_t_54 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13003  if (unlikely(__pyx_t_54 < 0)) __pyx_t_37 = 0;
13004  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_37 = 0;
13005  if (unlikely(__pyx_t_37 != -1)) {
13006  __Pyx_RaiseBufferIndexError(__pyx_t_37);
13007  __PYX_ERR(0, 568, __pyx_L1_error)
13008  }
13009  __pyx_t_55 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_rowptr.diminfo[0].strides));
13010  __pyx_t_56 = __pyx_v_I;
13011  __pyx_t_37 = -1;
13012  if (__pyx_t_56 < 0) {
13013  __pyx_t_56 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13014  if (unlikely(__pyx_t_56 < 0)) __pyx_t_37 = 0;
13015  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_37 = 0;
13016  if (unlikely(__pyx_t_37 != -1)) {
13017  __Pyx_RaiseBufferIndexError(__pyx_t_37);
13018  __PYX_ERR(0, 568, __pyx_L1_error)
13019  }
13020  __pyx_t_57 = __pyx_t_55;
13021  for (__pyx_t_37 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_37 < __pyx_t_57; __pyx_t_37+=1) {
13022  __pyx_v_ii = __pyx_t_37;
13023 
13024  /* "subsurfaceTransportFunctions.pyx":569
13025  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
13026  * for ii in range(rowptr[I],rowptr[I+1]):
13027  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
13028  * #I
13029  * #j
13030  */
13031  __pyx_t_58 = __pyx_v_ii;
13032  __pyx_t_59 = -1;
13033  if (__pyx_t_58 < 0) {
13034  __pyx_t_58 += __pyx_pybuffernd_a_up.diminfo[0].shape;
13035  if (unlikely(__pyx_t_58 < 0)) __pyx_t_59 = 0;
13036  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_59 = 0;
13037  if (unlikely(__pyx_t_59 != -1)) {
13038  __Pyx_RaiseBufferIndexError(__pyx_t_59);
13039  __PYX_ERR(0, 569, __pyx_L1_error)
13040  }
13041  __pyx_t_60 = __pyx_v_ii;
13042  __pyx_t_59 = -1;
13043  if (__pyx_t_60 < 0) {
13044  __pyx_t_60 += __pyx_pybuffernd_colind.diminfo[0].shape;
13045  if (unlikely(__pyx_t_60 < 0)) __pyx_t_59 = 0;
13046  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_59 = 0;
13047  if (unlikely(__pyx_t_59 != -1)) {
13048  __Pyx_RaiseBufferIndexError(__pyx_t_59);
13049  __PYX_ERR(0, 569, __pyx_L1_error)
13050  }
13051  __pyx_t_61 = __pyx_v_eN;
13052  __pyx_t_62 = __pyx_v_ebN;
13053  __pyx_t_63 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_colind.diminfo[0].strides));
13054  __pyx_t_59 = -1;
13055  if (__pyx_t_61 < 0) {
13056  __pyx_t_61 += __pyx_pybuffernd_q_grad_u.diminfo[0].shape;
13057  if (unlikely(__pyx_t_61 < 0)) __pyx_t_59 = 0;
13058  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_q_grad_u.diminfo[0].shape)) __pyx_t_59 = 0;
13059  if (__pyx_t_62 < 0) {
13060  __pyx_t_62 += __pyx_pybuffernd_q_grad_u.diminfo[1].shape;
13061  if (unlikely(__pyx_t_62 < 0)) __pyx_t_59 = 1;
13062  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_q_grad_u.diminfo[1].shape)) __pyx_t_59 = 1;
13063  if (__pyx_t_63 < 0) {
13064  __pyx_t_63 += __pyx_pybuffernd_q_grad_u.diminfo[2].shape;
13065  if (unlikely(__pyx_t_63 < 0)) __pyx_t_59 = 2;
13066  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_q_grad_u.diminfo[2].shape)) __pyx_t_59 = 2;
13067  if (unlikely(__pyx_t_59 != -1)) {
13068  __Pyx_RaiseBufferIndexError(__pyx_t_59);
13069  __PYX_ERR(0, 569, __pyx_L1_error)
13070  }
13071  __pyx_t_64 = __pyx_v_eN;
13072  __pyx_t_65 = __pyx_v_ebN;
13073  __pyx_t_66 = __pyx_v_i;
13074  __pyx_t_67 = __pyx_v_I;
13075  __pyx_t_59 = -1;
13076  if (__pyx_t_64 < 0) {
13077  __pyx_t_64 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
13078  if (unlikely(__pyx_t_64 < 0)) __pyx_t_59 = 0;
13079  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_59 = 0;
13080  if (__pyx_t_65 < 0) {
13081  __pyx_t_65 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
13082  if (unlikely(__pyx_t_65 < 0)) __pyx_t_59 = 1;
13083  } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_59 = 1;
13084  if (__pyx_t_66 < 0) {
13085  __pyx_t_66 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
13086  if (unlikely(__pyx_t_66 < 0)) __pyx_t_59 = 2;
13087  } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_59 = 2;
13088  if (__pyx_t_67 < 0) {
13089  __pyx_t_67 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
13090  if (unlikely(__pyx_t_67 < 0)) __pyx_t_59 = 3;
13091  } else if (unlikely(__pyx_t_67 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_59 = 3;
13092  if (unlikely(__pyx_t_59 != -1)) {
13093  __Pyx_RaiseBufferIndexError(__pyx_t_59);
13094  __PYX_ERR(0, 569, __pyx_L1_error)
13095  }
13096  __pyx_t_68 = __pyx_v_eN;
13097  __pyx_t_69 = __pyx_v_i;
13098  __pyx_t_59 = -1;
13099  if (__pyx_t_68 < 0) {
13100  __pyx_t_68 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
13101  if (unlikely(__pyx_t_68 < 0)) __pyx_t_59 = 0;
13102  } else if (unlikely(__pyx_t_68 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_59 = 0;
13103  if (__pyx_t_69 < 0) {
13104  __pyx_t_69 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
13105  if (unlikely(__pyx_t_69 < 0)) __pyx_t_59 = 1;
13106  } else if (unlikely(__pyx_t_69 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_59 = 1;
13107  if (unlikely(__pyx_t_59 != -1)) {
13108  __Pyx_RaiseBufferIndexError(__pyx_t_59);
13109  __PYX_ERR(0, 569, __pyx_L1_error)
13110  }
13111  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_69, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_q_grad_u.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_q_grad_u.diminfo[1].strides, __pyx_t_63, __pyx_pybuffernd_q_grad_u.diminfo[2].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_66, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_67, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
13112  }
13113  }
13114  }
13115  }
13116  }
13117 
13118  /* "subsurfaceTransportFunctions.pyx":486
13119  * #eN for upwind
13120  *
13121  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
13122  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
13123  * numpy.ndarray[ITYPE_t,ndim=1] colind,
13124  */
13125 
13126  /* function exit code */
13127  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13128  goto __pyx_L0;
13129  __pyx_L1_error:;
13130  __Pyx_XDECREF(__pyx_t_1);
13131  __Pyx_XDECREF(__pyx_t_2);
13132  __Pyx_XDECREF(__pyx_t_4);
13133  __Pyx_XDECREF(__pyx_t_5);
13134  __Pyx_XDECREF(__pyx_t_9);
13135  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
13136  __Pyx_PyThreadState_declare
13137  __Pyx_PyThreadState_assign
13138  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
13139  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13140  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13141  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13142  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13143  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
13144  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13145  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13146  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13147  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13148  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13149  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13150  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13151  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13152  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13153  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13154  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13155  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13156  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13157  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13158  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
13159  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
13160  __pyx_r = NULL;
13161  goto __pyx_L2;
13162  __pyx_L0:;
13163  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13164  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13165  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13166  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13167  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
13168  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13169  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13170  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13171  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13172  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13173  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13174  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13175  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13176  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13177  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13178  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13179  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13180  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13181  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13182  __pyx_L2:;
13183  __Pyx_XDECREF(__pyx_v_q);
13184  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
13185  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
13186  __Pyx_XGIVEREF(__pyx_r);
13187  __Pyx_RefNannyFinishContext();
13188  return __pyx_r;
13189 }
13190 
13191 /* "subsurfaceTransportFunctions.pyx":574
13192  * #i
13193  * #eN
13194  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
13195  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
13196  * numpy.ndarray[ITYPE_t,ndim=1] colind,
13197  */
13198 
13199 /* Python wrapper */
13200 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13201 static char __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
13202 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian = {"RE_NCP1_getElementJacobian", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian};
13203 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13204  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
13205  PyArrayObject *__pyx_v_rowptr = 0;
13206  PyArrayObject *__pyx_v_colind = 0;
13207  int __pyx_v_nSpace;
13208  int __pyx_v_nElements_global;
13209  int __pyx_v_nElementBoundaries_element;
13210  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
13211  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
13212  int __pyx_v_nDOF_test_element;
13213  int __pyx_v_nDOF_trial_element;
13214  PyArrayObject *__pyx_v_q_u = 0;
13215  CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u = 0;
13216  PyArrayObject *__pyx_v_q_grad_w = 0;
13217  PyArrayObject *__pyx_v_q_grad_v = 0;
13218  PyArrayObject *__pyx_v_q_detJ = 0;
13219  PyArrayObject *__pyx_v_q_m = 0;
13220  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm = 0;
13221  PyArrayObject *__pyx_v_q_mt = 0;
13222  PyArrayObject *__pyx_v_q_dmt = 0;
13223  PyArrayObject *__pyx_v_q_r = 0;
13224  PyArrayObject *__pyx_v_q_kr = 0;
13225  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr = 0;
13226  PyArrayObject *__pyx_v_q_kr_up = 0;
13227  PyArrayObject *__pyx_v_q_flin = 0;
13228  PyArrayObject *__pyx_v_q_alin = 0;
13229  PyArrayObject *__pyx_v_elementJacobian = 0;
13230  PyObject *__pyx_r = 0;
13231  __Pyx_RefNannyDeclarations
13232  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian (wrapper)", 0);
13233  {
13234  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_grad_v,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_dm,&__pyx_n_s_q_mt,&__pyx_n_s_q_dmt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementJacobian,0};
13235  PyObject* values[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
13236  if (unlikely(__pyx_kwds)) {
13237  Py_ssize_t kw_args;
13238  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13239  switch (pos_args) {
13240  case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
13241  CYTHON_FALLTHROUGH;
13242  case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
13243  CYTHON_FALLTHROUGH;
13244  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
13245  CYTHON_FALLTHROUGH;
13246  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
13247  CYTHON_FALLTHROUGH;
13248  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
13249  CYTHON_FALLTHROUGH;
13250  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
13251  CYTHON_FALLTHROUGH;
13252  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
13253  CYTHON_FALLTHROUGH;
13254  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
13255  CYTHON_FALLTHROUGH;
13256  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
13257  CYTHON_FALLTHROUGH;
13258  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
13259  CYTHON_FALLTHROUGH;
13260  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
13261  CYTHON_FALLTHROUGH;
13262  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
13263  CYTHON_FALLTHROUGH;
13264  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
13265  CYTHON_FALLTHROUGH;
13266  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
13267  CYTHON_FALLTHROUGH;
13268  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
13269  CYTHON_FALLTHROUGH;
13270  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
13271  CYTHON_FALLTHROUGH;
13272  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
13273  CYTHON_FALLTHROUGH;
13274  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
13275  CYTHON_FALLTHROUGH;
13276  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
13277  CYTHON_FALLTHROUGH;
13278  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
13279  CYTHON_FALLTHROUGH;
13280  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
13281  CYTHON_FALLTHROUGH;
13282  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13283  CYTHON_FALLTHROUGH;
13284  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13285  CYTHON_FALLTHROUGH;
13286  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13287  CYTHON_FALLTHROUGH;
13288  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13289  CYTHON_FALLTHROUGH;
13290  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13291  CYTHON_FALLTHROUGH;
13292  case 0: break;
13293  default: goto __pyx_L5_argtuple_error;
13294  }
13295  kw_args = PyDict_Size(__pyx_kwds);
13296  switch (pos_args) {
13297  case 0:
13298  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
13299  else goto __pyx_L5_argtuple_error;
13300  CYTHON_FALLTHROUGH;
13301  case 1:
13302  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
13303  else {
13304  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 1); __PYX_ERR(0, 574, __pyx_L3_error)
13305  }
13306  CYTHON_FALLTHROUGH;
13307  case 2:
13308  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
13309  else {
13310  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 2); __PYX_ERR(0, 574, __pyx_L3_error)
13311  }
13312  CYTHON_FALLTHROUGH;
13313  case 3:
13314  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
13315  else {
13316  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 3); __PYX_ERR(0, 574, __pyx_L3_error)
13317  }
13318  CYTHON_FALLTHROUGH;
13319  case 4:
13320  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
13321  else {
13322  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 4); __PYX_ERR(0, 574, __pyx_L3_error)
13323  }
13324  CYTHON_FALLTHROUGH;
13325  case 5:
13326  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
13327  else {
13328  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 5); __PYX_ERR(0, 574, __pyx_L3_error)
13329  }
13330  CYTHON_FALLTHROUGH;
13331  case 6:
13332  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
13333  else {
13334  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 6); __PYX_ERR(0, 574, __pyx_L3_error)
13335  }
13336  CYTHON_FALLTHROUGH;
13337  case 7:
13338  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
13339  else {
13340  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 7); __PYX_ERR(0, 574, __pyx_L3_error)
13341  }
13342  CYTHON_FALLTHROUGH;
13343  case 8:
13344  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
13345  else {
13346  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 8); __PYX_ERR(0, 574, __pyx_L3_error)
13347  }
13348  CYTHON_FALLTHROUGH;
13349  case 9:
13350  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
13351  else {
13352  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 9); __PYX_ERR(0, 574, __pyx_L3_error)
13353  }
13354  CYTHON_FALLTHROUGH;
13355  case 10:
13356  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
13357  else {
13358  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 10); __PYX_ERR(0, 574, __pyx_L3_error)
13359  }
13360  CYTHON_FALLTHROUGH;
13361  case 11:
13362  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
13363  else {
13364  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 11); __PYX_ERR(0, 574, __pyx_L3_error)
13365  }
13366  CYTHON_FALLTHROUGH;
13367  case 12:
13368  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
13369  else {
13370  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 12); __PYX_ERR(0, 574, __pyx_L3_error)
13371  }
13372  CYTHON_FALLTHROUGH;
13373  case 13:
13374  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_v)) != 0)) kw_args--;
13375  else {
13376  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 13); __PYX_ERR(0, 574, __pyx_L3_error)
13377  }
13378  CYTHON_FALLTHROUGH;
13379  case 14:
13380  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
13381  else {
13382  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 14); __PYX_ERR(0, 574, __pyx_L3_error)
13383  }
13384  CYTHON_FALLTHROUGH;
13385  case 15:
13386  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
13387  else {
13388  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 15); __PYX_ERR(0, 574, __pyx_L3_error)
13389  }
13390  CYTHON_FALLTHROUGH;
13391  case 16:
13392  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dm)) != 0)) kw_args--;
13393  else {
13394  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 16); __PYX_ERR(0, 574, __pyx_L3_error)
13395  }
13396  CYTHON_FALLTHROUGH;
13397  case 17:
13398  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
13399  else {
13400  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 17); __PYX_ERR(0, 574, __pyx_L3_error)
13401  }
13402  CYTHON_FALLTHROUGH;
13403  case 18:
13404  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dmt)) != 0)) kw_args--;
13405  else {
13406  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 18); __PYX_ERR(0, 574, __pyx_L3_error)
13407  }
13408  CYTHON_FALLTHROUGH;
13409  case 19:
13410  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
13411  else {
13412  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 19); __PYX_ERR(0, 574, __pyx_L3_error)
13413  }
13414  CYTHON_FALLTHROUGH;
13415  case 20:
13416  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
13417  else {
13418  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 20); __PYX_ERR(0, 574, __pyx_L3_error)
13419  }
13420  CYTHON_FALLTHROUGH;
13421  case 21:
13422  if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
13423  else {
13424  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 21); __PYX_ERR(0, 574, __pyx_L3_error)
13425  }
13426  CYTHON_FALLTHROUGH;
13427  case 22:
13428  if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
13429  else {
13430  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 22); __PYX_ERR(0, 574, __pyx_L3_error)
13431  }
13432  CYTHON_FALLTHROUGH;
13433  case 23:
13434  if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
13435  else {
13436  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 23); __PYX_ERR(0, 574, __pyx_L3_error)
13437  }
13438  CYTHON_FALLTHROUGH;
13439  case 24:
13440  if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
13441  else {
13442  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 24); __PYX_ERR(0, 574, __pyx_L3_error)
13443  }
13444  CYTHON_FALLTHROUGH;
13445  case 25:
13446  if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementJacobian)) != 0)) kw_args--;
13447  else {
13448  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 25); __PYX_ERR(0, 574, __pyx_L3_error)
13449  }
13450  }
13451  if (unlikely(kw_args > 0)) {
13452  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementJacobian") < 0)) __PYX_ERR(0, 574, __pyx_L3_error)
13453  }
13454  } else if (PyTuple_GET_SIZE(__pyx_args) != 26) {
13455  goto __pyx_L5_argtuple_error;
13456  } else {
13457  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13458  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13459  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13460  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13461  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13462  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
13463  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
13464  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
13465  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
13466  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
13467  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
13468  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
13469  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
13470  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
13471  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
13472  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
13473  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
13474  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
13475  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
13476  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
13477  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
13478  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
13479  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
13480  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
13481  values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
13482  values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
13483  }
13484  __pyx_v_gravity = ((PyArrayObject *)values[0]);
13485  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
13486  __pyx_v_colind = ((PyArrayObject *)values[2]);
13487  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L3_error)
13488  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 579, __pyx_L3_error)
13489  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error)
13490  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
13491  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
13492  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 584, __pyx_L3_error)
13493  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 585, __pyx_L3_error)
13494  __pyx_v_q_u = ((PyArrayObject *)values[10]);
13495  __pyx_v_q_grad_u = ((PyArrayObject *)values[11]);
13496  __pyx_v_q_grad_w = ((PyArrayObject *)values[12]);
13497  __pyx_v_q_grad_v = ((PyArrayObject *)values[13]);
13498  __pyx_v_q_detJ = ((PyArrayObject *)values[14]);
13499  __pyx_v_q_m = ((PyArrayObject *)values[15]);
13500  __pyx_v_q_dm = ((PyArrayObject *)values[16]);
13501  __pyx_v_q_mt = ((PyArrayObject *)values[17]);
13502  __pyx_v_q_dmt = ((PyArrayObject *)values[18]);
13503  __pyx_v_q_r = ((PyArrayObject *)values[19]);
13504  __pyx_v_q_kr = ((PyArrayObject *)values[20]);
13505  __pyx_v_q_dkr = ((PyArrayObject *)values[21]);
13506  __pyx_v_q_kr_up = ((PyArrayObject *)values[22]);
13507  __pyx_v_q_flin = ((PyArrayObject *)values[23]);
13508  __pyx_v_q_alin = ((PyArrayObject *)values[24]);
13509  __pyx_v_elementJacobian = ((PyArrayObject *)values[25]);
13510  }
13511  goto __pyx_L4_argument_unpacking_done;
13512  __pyx_L5_argtuple_error:;
13513  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 574, __pyx_L3_error)
13514  __pyx_L3_error:;
13515  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
13516  __Pyx_RefNannyFinishContext();
13517  return NULL;
13518  __pyx_L4_argument_unpacking_done:;
13519  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 574, __pyx_L1_error)
13520  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 575, __pyx_L1_error)
13521  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 576, __pyx_L1_error)
13522  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 581, __pyx_L1_error)
13523  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 582, __pyx_L1_error)
13524  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 586, __pyx_L1_error)
13525  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 587, __pyx_L1_error)
13526  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 588, __pyx_L1_error)
13527  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_v), __pyx_ptype_5numpy_ndarray, 1, "q_grad_v", 0))) __PYX_ERR(0, 589, __pyx_L1_error)
13528  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 591, __pyx_L1_error)
13529  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 592, __pyx_L1_error)
13530  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dm), __pyx_ptype_5numpy_ndarray, 1, "q_dm", 0))) __PYX_ERR(0, 593, __pyx_L1_error)
13531  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 594, __pyx_L1_error)
13532  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmt), __pyx_ptype_5numpy_ndarray, 1, "q_dmt", 0))) __PYX_ERR(0, 595, __pyx_L1_error)
13533  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 596, __pyx_L1_error)
13534  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 597, __pyx_L1_error)
13535  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 598, __pyx_L1_error)
13536  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 599, __pyx_L1_error)
13537  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 602, __pyx_L1_error)
13538  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 603, __pyx_L1_error)
13539  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementJacobian), __pyx_ptype_5numpy_ndarray, 1, "elementJacobian", 0))) __PYX_ERR(0, 605, __pyx_L1_error)
13540  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_nDOF_trial_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_grad_v, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_dm, __pyx_v_q_mt, __pyx_v_q_dmt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementJacobian);
13541 
13542  /* function exit code */
13543  goto __pyx_L0;
13544  __pyx_L1_error:;
13545  __pyx_r = NULL;
13546  __pyx_L0:;
13547  __Pyx_RefNannyFinishContext();
13548  return __pyx_r;
13549 }
13550 
13551 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian) {
13552  CYTHON_UNUSED int __pyx_v_upwindFlag;
13553  CYTHON_UNUSED int __pyx_v_picard;
13554  PyObject *__pyx_v_q = NULL;
13555  int __pyx_v_nnz;
13556  int __pyx_v_eN;
13557  int __pyx_v_ii;
13558  int __pyx_v_I;
13559  PyArrayObject *__pyx_v_a_up = 0;
13560  PyArrayObject *__pyx_v_f_up = 0;
13561  double __pyx_v_nAvgWeight;
13562  double __pyx_v_weight;
13563  double __pyx_v_volFactor;
13564  CYTHON_UNUSED int __pyx_v_thisElementIsUpwind;
13565  double __pyx_v_volume;
13566  int __pyx_v_i;
13567  int __pyx_v_ebN;
13568  int __pyx_v_j;
13569  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
13570  __Pyx_Buffer __pyx_pybuffer_a_up;
13571  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
13572  __Pyx_Buffer __pyx_pybuffer_colind;
13573  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
13574  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
13575  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementJacobian;
13576  __Pyx_Buffer __pyx_pybuffer_elementJacobian;
13577  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
13578  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
13579  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
13580  __Pyx_Buffer __pyx_pybuffer_f_up;
13581  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
13582  __Pyx_Buffer __pyx_pybuffer_gravity;
13583  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
13584  __Pyx_Buffer __pyx_pybuffer_q_alin;
13585  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
13586  __Pyx_Buffer __pyx_pybuffer_q_detJ;
13587  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
13588  __Pyx_Buffer __pyx_pybuffer_q_dkr;
13589  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dm;
13590  __Pyx_Buffer __pyx_pybuffer_q_dm;
13591  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmt;
13592  __Pyx_Buffer __pyx_pybuffer_q_dmt;
13593  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
13594  __Pyx_Buffer __pyx_pybuffer_q_flin;
13595  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
13596  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
13597  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_v;
13598  __Pyx_Buffer __pyx_pybuffer_q_grad_v;
13599  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
13600  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
13601  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
13602  __Pyx_Buffer __pyx_pybuffer_q_kr;
13603  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
13604  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
13605  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
13606  __Pyx_Buffer __pyx_pybuffer_q_m;
13607  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
13608  __Pyx_Buffer __pyx_pybuffer_q_mt;
13609  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
13610  __Pyx_Buffer __pyx_pybuffer_q_r;
13611  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
13612  __Pyx_Buffer __pyx_pybuffer_q_u;
13613  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
13614  __Pyx_Buffer __pyx_pybuffer_rowptr;
13615  PyObject *__pyx_r = NULL;
13616  __Pyx_RefNannyDeclarations
13617  PyObject *__pyx_t_1 = NULL;
13618  PyObject *__pyx_t_2 = NULL;
13619  Py_ssize_t __pyx_t_3;
13620  PyObject *__pyx_t_4 = NULL;
13621  PyObject *__pyx_t_5 = NULL;
13622  int __pyx_t_6;
13623  Py_ssize_t __pyx_t_7;
13624  int __pyx_t_8;
13625  PyObject *__pyx_t_9 = NULL;
13626  PyArrayObject *__pyx_t_10 = NULL;
13627  PyArrayObject *__pyx_t_11 = NULL;
13628  double __pyx_t_12;
13629  int __pyx_t_13;
13630  int __pyx_t_14;
13631  Py_ssize_t __pyx_t_15;
13632  Py_ssize_t __pyx_t_16;
13633  int __pyx_t_17;
13634  int __pyx_t_18;
13635  int __pyx_t_19;
13636  Py_ssize_t __pyx_t_20;
13637  Py_ssize_t __pyx_t_21;
13638  int __pyx_t_22;
13639  Py_ssize_t __pyx_t_23;
13640  Py_ssize_t __pyx_t_24;
13641  Py_ssize_t __pyx_t_25;
13642  int __pyx_t_26;
13643  int __pyx_t_27;
13644  int __pyx_t_28;
13645  int __pyx_t_29;
13646  int __pyx_t_30;
13647  Py_ssize_t __pyx_t_31;
13648  Py_ssize_t __pyx_t_32;
13649  Py_ssize_t __pyx_t_33;
13650  int __pyx_t_34;
13651  Py_ssize_t __pyx_t_35;
13652  Py_ssize_t __pyx_t_36;
13653  Py_ssize_t __pyx_t_37;
13654  Py_ssize_t __pyx_t_38;
13655  Py_ssize_t __pyx_t_39;
13656  Py_ssize_t __pyx_t_40;
13657  Py_ssize_t __pyx_t_41;
13658  Py_ssize_t __pyx_t_42;
13659  Py_ssize_t __pyx_t_43;
13660  int __pyx_t_44;
13661  int __pyx_t_45;
13662  Py_ssize_t __pyx_t_46;
13663  int __pyx_t_47;
13664  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_48;
13665  Py_ssize_t __pyx_t_49;
13666  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_50;
13667  Py_ssize_t __pyx_t_51;
13668  int __pyx_t_52;
13669  Py_ssize_t __pyx_t_53;
13670  Py_ssize_t __pyx_t_54;
13671  Py_ssize_t __pyx_t_55;
13672  Py_ssize_t __pyx_t_56;
13673  Py_ssize_t __pyx_t_57;
13674  Py_ssize_t __pyx_t_58;
13675  Py_ssize_t __pyx_t_59;
13676  Py_ssize_t __pyx_t_60;
13677  Py_ssize_t __pyx_t_61;
13678  Py_ssize_t __pyx_t_62;
13679  Py_ssize_t __pyx_t_63;
13680  Py_ssize_t __pyx_t_64;
13681  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian", 0);
13682  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
13683  __pyx_pybuffer_a_up.refcount = 0;
13684  __pyx_pybuffernd_a_up.data = NULL;
13685  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
13686  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
13687  __pyx_pybuffer_f_up.refcount = 0;
13688  __pyx_pybuffernd_f_up.data = NULL;
13689  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
13690  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
13691  __pyx_pybuffer_gravity.refcount = 0;
13692  __pyx_pybuffernd_gravity.data = NULL;
13693  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
13694  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
13695  __pyx_pybuffer_rowptr.refcount = 0;
13696  __pyx_pybuffernd_rowptr.data = NULL;
13697  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
13698  __pyx_pybuffer_colind.pybuffer.buf = NULL;
13699  __pyx_pybuffer_colind.refcount = 0;
13700  __pyx_pybuffernd_colind.data = NULL;
13701  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
13702  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
13703  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
13704  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
13705  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
13706  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
13707  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
13708  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
13709  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
13710  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
13711  __pyx_pybuffer_q_u.refcount = 0;
13712  __pyx_pybuffernd_q_u.data = NULL;
13713  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
13714  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
13715  __pyx_pybuffer_q_grad_u.refcount = 0;
13716  __pyx_pybuffernd_q_grad_u.data = NULL;
13717  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
13718  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
13719  __pyx_pybuffer_q_grad_w.refcount = 0;
13720  __pyx_pybuffernd_q_grad_w.data = NULL;
13721  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
13722  __pyx_pybuffer_q_grad_v.pybuffer.buf = NULL;
13723  __pyx_pybuffer_q_grad_v.refcount = 0;
13724  __pyx_pybuffernd_q_grad_v.data = NULL;
13725  __pyx_pybuffernd_q_grad_v.rcbuffer = &__pyx_pybuffer_q_grad_v;
13726  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
13727  __pyx_pybuffer_q_detJ.refcount = 0;
13728  __pyx_pybuffernd_q_detJ.data = NULL;
13729  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
13730  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
13731  __pyx_pybuffer_q_m.refcount = 0;
13732  __pyx_pybuffernd_q_m.data = NULL;
13733  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
13734  __pyx_pybuffer_q_dm.pybuffer.buf = NULL;
13735  __pyx_pybuffer_q_dm.refcount = 0;
13736  __pyx_pybuffernd_q_dm.data = NULL;
13737  __pyx_pybuffernd_q_dm.rcbuffer = &__pyx_pybuffer_q_dm;
13738  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
13739  __pyx_pybuffer_q_mt.refcount = 0;
13740  __pyx_pybuffernd_q_mt.data = NULL;
13741  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
13742  __pyx_pybuffer_q_dmt.pybuffer.buf = NULL;
13743  __pyx_pybuffer_q_dmt.refcount = 0;
13744  __pyx_pybuffernd_q_dmt.data = NULL;
13745  __pyx_pybuffernd_q_dmt.rcbuffer = &__pyx_pybuffer_q_dmt;
13746  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
13747  __pyx_pybuffer_q_r.refcount = 0;
13748  __pyx_pybuffernd_q_r.data = NULL;
13749  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
13750  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
13751  __pyx_pybuffer_q_kr.refcount = 0;
13752  __pyx_pybuffernd_q_kr.data = NULL;
13753  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
13754  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
13755  __pyx_pybuffer_q_dkr.refcount = 0;
13756  __pyx_pybuffernd_q_dkr.data = NULL;
13757  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
13758  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
13759  __pyx_pybuffer_q_kr_up.refcount = 0;
13760  __pyx_pybuffernd_q_kr_up.data = NULL;
13761  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
13762  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
13763  __pyx_pybuffer_q_flin.refcount = 0;
13764  __pyx_pybuffernd_q_flin.data = NULL;
13765  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
13766  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
13767  __pyx_pybuffer_q_alin.refcount = 0;
13768  __pyx_pybuffernd_q_alin.data = NULL;
13769  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
13770  __pyx_pybuffer_elementJacobian.pybuffer.buf = NULL;
13771  __pyx_pybuffer_elementJacobian.refcount = 0;
13772  __pyx_pybuffernd_elementJacobian.data = NULL;
13773  __pyx_pybuffernd_elementJacobian.rcbuffer = &__pyx_pybuffer_elementJacobian;
13774  {
13775  __Pyx_BufFmt_StackElem __pyx_stack[1];
13776  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13777  }
13778  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
13779  {
13780  __Pyx_BufFmt_StackElem __pyx_stack[1];
13781  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13782  }
13783  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
13784  {
13785  __Pyx_BufFmt_StackElem __pyx_stack[1];
13786  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13787  }
13788  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
13789  {
13790  __Pyx_BufFmt_StackElem __pyx_stack[1];
13791  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13792  }
13793  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
13794  {
13795  __Pyx_BufFmt_StackElem __pyx_stack[1];
13796  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13797  }
13798  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
13799  {
13800  __Pyx_BufFmt_StackElem __pyx_stack[1];
13801  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13802  }
13803  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
13804  {
13805  __Pyx_BufFmt_StackElem __pyx_stack[1];
13806  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13807  }
13808  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
13809  {
13810  __Pyx_BufFmt_StackElem __pyx_stack[1];
13811  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13812  }
13813  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
13814  {
13815  __Pyx_BufFmt_StackElem __pyx_stack[1];
13816  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13817  }
13818  __pyx_pybuffernd_q_grad_v.diminfo[0].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_v.diminfo[0].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_v.diminfo[1].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_v.diminfo[1].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_v.diminfo[2].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_v.diminfo[2].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_v.diminfo[3].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_v.diminfo[3].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[3];
13819  {
13820  __Pyx_BufFmt_StackElem __pyx_stack[1];
13821  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13822  }
13823  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
13824  {
13825  __Pyx_BufFmt_StackElem __pyx_stack[1];
13826  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13827  }
13828  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
13829  {
13830  __Pyx_BufFmt_StackElem __pyx_stack[1];
13831  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13832  }
13833  __pyx_pybuffernd_q_dm.diminfo[0].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dm.diminfo[0].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dm.diminfo[1].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dm.diminfo[1].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[1];
13834  {
13835  __Pyx_BufFmt_StackElem __pyx_stack[1];
13836  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13837  }
13838  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
13839  {
13840  __Pyx_BufFmt_StackElem __pyx_stack[1];
13841  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13842  }
13843  __pyx_pybuffernd_q_dmt.diminfo[0].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmt.diminfo[0].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmt.diminfo[1].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmt.diminfo[1].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[1];
13844  {
13845  __Pyx_BufFmt_StackElem __pyx_stack[1];
13846  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13847  }
13848  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
13849  {
13850  __Pyx_BufFmt_StackElem __pyx_stack[1];
13851  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13852  }
13853  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
13854  {
13855  __Pyx_BufFmt_StackElem __pyx_stack[1];
13856  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13857  }
13858  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
13859  {
13860  __Pyx_BufFmt_StackElem __pyx_stack[1];
13861  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13862  }
13863  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
13864  {
13865  __Pyx_BufFmt_StackElem __pyx_stack[1];
13866  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13867  }
13868  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
13869  {
13870  __Pyx_BufFmt_StackElem __pyx_stack[1];
13871  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13872  }
13873  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
13874  {
13875  __Pyx_BufFmt_StackElem __pyx_stack[1];
13876  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementJacobian, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13877  }
13878  __pyx_pybuffernd_elementJacobian.diminfo[0].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementJacobian.diminfo[0].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementJacobian.diminfo[1].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementJacobian.diminfo[1].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_elementJacobian.diminfo[2].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_elementJacobian.diminfo[2].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[2];
13879 
13880  /* "subsurfaceTransportFunctions.pyx":620
13881  *
13882  * """
13883  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
13884  * cdef int picard = 1
13885  * #check some sizes
13886  */
13887  __pyx_v_upwindFlag = 1;
13888 
13889  /* "subsurfaceTransportFunctions.pyx":621
13890  * """
13891  * cdef int upwindFlag = 1
13892  * cdef int picard = 1 # <<<<<<<<<<<<<<
13893  * #check some sizes
13894  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13895  */
13896  __pyx_v_picard = 1;
13897 
13898  /* "subsurfaceTransportFunctions.pyx":623
13899  * cdef int picard = 1
13900  * #check some sizes
13901  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13902  * assert q.shape[1] == nSpace+1
13903  * assert nDOF_test_element == nSpace+1
13904  */
13905  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13906  __Pyx_GOTREF(__pyx_t_1);
13907  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
13908  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
13909  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
13910  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
13911  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
13912  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
13913  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
13914  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
13915  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
13916  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
13917  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
13918  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
13919  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
13920  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
13921  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
13922  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
13923  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13924  for (;;) {
13925  if (__pyx_t_3 >= 5) break;
13926  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13927  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 623, __pyx_L1_error)
13928  #else
13929  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13930  __Pyx_GOTREF(__pyx_t_1);
13931  #endif
13932  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
13933  __pyx_t_1 = 0;
13934 
13935  /* "subsurfaceTransportFunctions.pyx":624
13936  * #check some sizes
13937  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13938  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
13939  * assert nDOF_test_element == nSpace+1
13940  * cdef int nnz = rowptr[nSpace]
13941  */
13942  #ifndef CYTHON_WITHOUT_ASSERTIONS
13943  if (unlikely(!Py_OptimizeFlag)) {
13944  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13945  __Pyx_GOTREF(__pyx_t_1);
13946  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error)
13947  __Pyx_GOTREF(__pyx_t_4);
13948  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13949  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13950  __Pyx_GOTREF(__pyx_t_1);
13951  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error)
13952  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13953  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13954  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 624, __pyx_L1_error)
13955  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13956  if (unlikely(!__pyx_t_6)) {
13957  PyErr_SetNone(PyExc_AssertionError);
13958  __PYX_ERR(0, 624, __pyx_L1_error)
13959  }
13960  }
13961  #endif
13962 
13963  /* "subsurfaceTransportFunctions.pyx":623
13964  * cdef int picard = 1
13965  * #check some sizes
13966  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13967  * assert q.shape[1] == nSpace+1
13968  * assert nDOF_test_element == nSpace+1
13969  */
13970  }
13971  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13972 
13973  /* "subsurfaceTransportFunctions.pyx":625
13974  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13975  * assert q.shape[1] == nSpace+1
13976  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
13977  * cdef int nnz = rowptr[nSpace]
13978  * #temporaries
13979  */
13980  #ifndef CYTHON_WITHOUT_ASSERTIONS
13981  if (unlikely(!Py_OptimizeFlag)) {
13982  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
13983  PyErr_SetNone(PyExc_AssertionError);
13984  __PYX_ERR(0, 625, __pyx_L1_error)
13985  }
13986  }
13987  #endif
13988 
13989  /* "subsurfaceTransportFunctions.pyx":626
13990  * assert q.shape[1] == nSpace+1
13991  * assert nDOF_test_element == nSpace+1
13992  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
13993  * #temporaries
13994  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
13995  */
13996  __pyx_t_7 = __pyx_v_nSpace;
13997  __pyx_t_8 = -1;
13998  if (__pyx_t_7 < 0) {
13999  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14000  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
14001  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
14002  if (unlikely(__pyx_t_8 != -1)) {
14003  __Pyx_RaiseBufferIndexError(__pyx_t_8);
14004  __PYX_ERR(0, 626, __pyx_L1_error)
14005  }
14006  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
14007 
14008  /* "subsurfaceTransportFunctions.pyx":630
14009  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
14010  * cdef int eN,eN_neighbor,ii,I
14011  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
14012  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
14013  * #for averaging/integration weights
14014  */
14015  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
14016  __Pyx_GOTREF(__pyx_t_5);
14017  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
14018  __Pyx_GOTREF(__pyx_t_1);
14019  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14020  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
14021  __Pyx_GOTREF(__pyx_t_5);
14022  __pyx_t_4 = NULL;
14023  __pyx_t_8 = 0;
14024  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
14025  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
14026  if (likely(__pyx_t_4)) {
14027  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
14028  __Pyx_INCREF(__pyx_t_4);
14029  __Pyx_INCREF(function);
14030  __Pyx_DECREF_SET(__pyx_t_1, function);
14031  __pyx_t_8 = 1;
14032  }
14033  }
14034  #if CYTHON_FAST_PYCALL
14035  if (PyFunction_Check(__pyx_t_1)) {
14036  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
14037  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
14038  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14039  __Pyx_GOTREF(__pyx_t_2);
14040  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14041  } else
14042  #endif
14043  #if CYTHON_FAST_PYCCALL
14044  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
14045  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
14046  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
14047  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14048  __Pyx_GOTREF(__pyx_t_2);
14049  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14050  } else
14051  #endif
14052  {
14053  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 630, __pyx_L1_error)
14054  __Pyx_GOTREF(__pyx_t_9);
14055  if (__pyx_t_4) {
14056  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
14057  }
14058  __Pyx_GIVEREF(__pyx_t_5);
14059  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
14060  __Pyx_INCREF(__pyx_n_s_d);
14061  __Pyx_GIVEREF(__pyx_n_s_d);
14062  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
14063  __pyx_t_5 = 0;
14064  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
14065  __Pyx_GOTREF(__pyx_t_2);
14066  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14067  }
14068  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14069  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 630, __pyx_L1_error)
14070  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
14071  {
14072  __Pyx_BufFmt_StackElem __pyx_stack[1];
14073  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
14074  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
14075  __PYX_ERR(0, 630, __pyx_L1_error)
14076  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
14077  }
14078  }
14079  __pyx_t_10 = 0;
14080  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
14081  __pyx_t_2 = 0;
14082 
14083  /* "subsurfaceTransportFunctions.pyx":631
14084  * cdef int eN,eN_neighbor,ii,I
14085  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
14086  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
14087  * #for averaging/integration weights
14088  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14089  */
14090  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
14091  __Pyx_GOTREF(__pyx_t_1);
14092  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 631, __pyx_L1_error)
14093  __Pyx_GOTREF(__pyx_t_9);
14094  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14095  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
14096  __Pyx_GOTREF(__pyx_t_1);
14097  __pyx_t_5 = NULL;
14098  __pyx_t_8 = 0;
14099  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
14100  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
14101  if (likely(__pyx_t_5)) {
14102  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
14103  __Pyx_INCREF(__pyx_t_5);
14104  __Pyx_INCREF(function);
14105  __Pyx_DECREF_SET(__pyx_t_9, function);
14106  __pyx_t_8 = 1;
14107  }
14108  }
14109  #if CYTHON_FAST_PYCALL
14110  if (PyFunction_Check(__pyx_t_9)) {
14111  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
14112  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14113  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14114  __Pyx_GOTREF(__pyx_t_2);
14115  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14116  } else
14117  #endif
14118  #if CYTHON_FAST_PYCCALL
14119  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
14120  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
14121  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14122  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14123  __Pyx_GOTREF(__pyx_t_2);
14124  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14125  } else
14126  #endif
14127  {
14128  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error)
14129  __Pyx_GOTREF(__pyx_t_4);
14130  if (__pyx_t_5) {
14131  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
14132  }
14133  __Pyx_GIVEREF(__pyx_t_1);
14134  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
14135  __Pyx_INCREF(__pyx_n_s_d);
14136  __Pyx_GIVEREF(__pyx_n_s_d);
14137  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
14138  __pyx_t_1 = 0;
14139  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14140  __Pyx_GOTREF(__pyx_t_2);
14141  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14142  }
14143  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14144  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 631, __pyx_L1_error)
14145  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
14146  {
14147  __Pyx_BufFmt_StackElem __pyx_stack[1];
14148  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
14149  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
14150  __PYX_ERR(0, 631, __pyx_L1_error)
14151  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
14152  }
14153  }
14154  __pyx_t_11 = 0;
14155  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
14156  __pyx_t_2 = 0;
14157 
14158  /* "subsurfaceTransportFunctions.pyx":633
14159  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
14160  * #for averaging/integration weights
14161  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
14162  * cdef double weight=1.0,volFactor = 1.0
14163  * cdef int thisElementIsUpwind = 1
14164  */
14165  __pyx_t_12 = (__pyx_v_nSpace + 1.);
14166  if (unlikely(__pyx_t_12 == 0)) {
14167  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
14168  __PYX_ERR(0, 633, __pyx_L1_error)
14169  }
14170  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
14171 
14172  /* "subsurfaceTransportFunctions.pyx":634
14173  * #for averaging/integration weights
14174  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14175  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
14176  * cdef int thisElementIsUpwind = 1
14177  * if nSpace == 2:
14178  */
14179  __pyx_v_weight = 1.0;
14180  __pyx_v_volFactor = 1.0;
14181 
14182  /* "subsurfaceTransportFunctions.pyx":635
14183  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14184  * cdef double weight=1.0,volFactor = 1.0
14185  * cdef int thisElementIsUpwind = 1 # <<<<<<<<<<<<<<
14186  * if nSpace == 2:
14187  * volFactor = 0.5
14188  */
14189  __pyx_v_thisElementIsUpwind = 1;
14190 
14191  /* "subsurfaceTransportFunctions.pyx":636
14192  * cdef double weight=1.0,volFactor = 1.0
14193  * cdef int thisElementIsUpwind = 1
14194  * if nSpace == 2: # <<<<<<<<<<<<<<
14195  * volFactor = 0.5
14196  * if nSpace == 3:
14197  */
14198  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
14199  if (__pyx_t_6) {
14200 
14201  /* "subsurfaceTransportFunctions.pyx":637
14202  * cdef int thisElementIsUpwind = 1
14203  * if nSpace == 2:
14204  * volFactor = 0.5 # <<<<<<<<<<<<<<
14205  * if nSpace == 3:
14206  * volFactor = 1.0/6.0
14207  */
14208  __pyx_v_volFactor = 0.5;
14209 
14210  /* "subsurfaceTransportFunctions.pyx":636
14211  * cdef double weight=1.0,volFactor = 1.0
14212  * cdef int thisElementIsUpwind = 1
14213  * if nSpace == 2: # <<<<<<<<<<<<<<
14214  * volFactor = 0.5
14215  * if nSpace == 3:
14216  */
14217  }
14218 
14219  /* "subsurfaceTransportFunctions.pyx":638
14220  * if nSpace == 2:
14221  * volFactor = 0.5
14222  * if nSpace == 3: # <<<<<<<<<<<<<<
14223  * volFactor = 1.0/6.0
14224  * #
14225  */
14226  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
14227  if (__pyx_t_6) {
14228 
14229  /* "subsurfaceTransportFunctions.pyx":639
14230  * volFactor = 0.5
14231  * if nSpace == 3:
14232  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
14233  * #
14234  * for eN in range(nElements_global):
14235  */
14236  __pyx_v_volFactor = (1.0 / 6.0);
14237 
14238  /* "subsurfaceTransportFunctions.pyx":638
14239  * if nSpace == 2:
14240  * volFactor = 0.5
14241  * if nSpace == 3: # <<<<<<<<<<<<<<
14242  * volFactor = 1.0/6.0
14243  * #
14244  */
14245  }
14246 
14247  /* "subsurfaceTransportFunctions.pyx":641
14248  * volFactor = 1.0/6.0
14249  * #
14250  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
14251  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
14252  * weight = nAvgWeight*volume
14253  */
14254  __pyx_t_8 = __pyx_v_nElements_global;
14255  __pyx_t_13 = __pyx_t_8;
14256  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
14257  __pyx_v_eN = __pyx_t_14;
14258 
14259  /* "subsurfaceTransportFunctions.pyx":642
14260  * #
14261  * for eN in range(nElements_global):
14262  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
14263  * weight = nAvgWeight*volume
14264  *
14265  */
14266  __pyx_t_15 = __pyx_v_eN;
14267  __pyx_t_16 = 0;
14268  __pyx_t_17 = -1;
14269  if (__pyx_t_15 < 0) {
14270  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
14271  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0;
14272  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_17 = 0;
14273  if (__pyx_t_16 < 0) {
14274  __pyx_t_16 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
14275  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
14276  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_17 = 1;
14277  if (unlikely(__pyx_t_17 != -1)) {
14278  __Pyx_RaiseBufferIndexError(__pyx_t_17);
14279  __PYX_ERR(0, 642, __pyx_L1_error)
14280  }
14281  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
14282 
14283  /* "subsurfaceTransportFunctions.pyx":643
14284  * for eN in range(nElements_global):
14285  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
14286  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
14287  *
14288  *
14289  */
14290  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
14291 
14292  /* "subsurfaceTransportFunctions.pyx":646
14293  *
14294  *
14295  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
14296  * #nodal quadrature so diagonal
14297  * ##mass
14298  */
14299  __pyx_t_17 = __pyx_v_nDOF_test_element;
14300  __pyx_t_18 = __pyx_t_17;
14301  for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
14302  __pyx_v_i = __pyx_t_19;
14303 
14304  /* "subsurfaceTransportFunctions.pyx":650
14305  * ##mass
14306  * #elementResidual[eN,i] += weight*q_m[eN,i]
14307  * elementJacobian[eN,i,i] += weight*q_dmt[eN,i] # <<<<<<<<<<<<<<
14308  *
14309  * #have to actually compute loop over other nodes for stiffness terms
14310  */
14311  __pyx_t_20 = __pyx_v_eN;
14312  __pyx_t_21 = __pyx_v_i;
14313  __pyx_t_22 = -1;
14314  if (__pyx_t_20 < 0) {
14315  __pyx_t_20 += __pyx_pybuffernd_q_dmt.diminfo[0].shape;
14316  if (unlikely(__pyx_t_20 < 0)) __pyx_t_22 = 0;
14317  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_dmt.diminfo[0].shape)) __pyx_t_22 = 0;
14318  if (__pyx_t_21 < 0) {
14319  __pyx_t_21 += __pyx_pybuffernd_q_dmt.diminfo[1].shape;
14320  if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 1;
14321  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_dmt.diminfo[1].shape)) __pyx_t_22 = 1;
14322  if (unlikely(__pyx_t_22 != -1)) {
14323  __Pyx_RaiseBufferIndexError(__pyx_t_22);
14324  __PYX_ERR(0, 650, __pyx_L1_error)
14325  }
14326  __pyx_t_23 = __pyx_v_eN;
14327  __pyx_t_24 = __pyx_v_i;
14328  __pyx_t_25 = __pyx_v_i;
14329  __pyx_t_22 = -1;
14330  if (__pyx_t_23 < 0) {
14331  __pyx_t_23 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
14332  if (unlikely(__pyx_t_23 < 0)) __pyx_t_22 = 0;
14333  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_22 = 0;
14334  if (__pyx_t_24 < 0) {
14335  __pyx_t_24 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
14336  if (unlikely(__pyx_t_24 < 0)) __pyx_t_22 = 1;
14337  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_22 = 1;
14338  if (__pyx_t_25 < 0) {
14339  __pyx_t_25 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
14340  if (unlikely(__pyx_t_25 < 0)) __pyx_t_22 = 2;
14341  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_22 = 2;
14342  if (unlikely(__pyx_t_22 != -1)) {
14343  __Pyx_RaiseBufferIndexError(__pyx_t_22);
14344  __PYX_ERR(0, 650, __pyx_L1_error)
14345  }
14346  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_q_dmt.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_q_dmt.diminfo[1].strides)));
14347 
14348  /* "subsurfaceTransportFunctions.pyx":653
14349  *
14350  * #have to actually compute loop over other nodes for stiffness terms
14351  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
14352  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14353  * for ii in range(nnz):
14354  */
14355  __pyx_t_22 = __pyx_v_nElementBoundaries_element;
14356  __pyx_t_26 = __pyx_t_22;
14357  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
14358  __pyx_v_ebN = __pyx_t_27;
14359 
14360  /* "subsurfaceTransportFunctions.pyx":655
14361  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
14362  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14363  * for ii in range(nnz): # <<<<<<<<<<<<<<
14364  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14365  * for I in range(nSpace):
14366  */
14367  __pyx_t_28 = __pyx_v_nnz;
14368  __pyx_t_29 = __pyx_t_28;
14369  for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) {
14370  __pyx_v_ii = __pyx_t_30;
14371 
14372  /* "subsurfaceTransportFunctions.pyx":656
14373  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14374  * for ii in range(nnz):
14375  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
14376  * for I in range(nSpace):
14377  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
14378  */
14379  __pyx_t_31 = __pyx_v_eN;
14380  __pyx_t_32 = __pyx_v_ebN;
14381  __pyx_t_33 = __pyx_v_ii;
14382  __pyx_t_34 = -1;
14383  if (__pyx_t_31 < 0) {
14384  __pyx_t_31 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
14385  if (unlikely(__pyx_t_31 < 0)) __pyx_t_34 = 0;
14386  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_34 = 0;
14387  if (__pyx_t_32 < 0) {
14388  __pyx_t_32 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
14389  if (unlikely(__pyx_t_32 < 0)) __pyx_t_34 = 1;
14390  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_34 = 1;
14391  if (__pyx_t_33 < 0) {
14392  __pyx_t_33 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
14393  if (unlikely(__pyx_t_33 < 0)) __pyx_t_34 = 2;
14394  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_34 = 2;
14395  if (unlikely(__pyx_t_34 != -1)) {
14396  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14397  __PYX_ERR(0, 656, __pyx_L1_error)
14398  }
14399  __pyx_t_35 = __pyx_v_eN;
14400  __pyx_t_36 = __pyx_v_ebN;
14401  __pyx_t_34 = -1;
14402  if (__pyx_t_35 < 0) {
14403  __pyx_t_35 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
14404  if (unlikely(__pyx_t_35 < 0)) __pyx_t_34 = 0;
14405  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_34 = 0;
14406  if (__pyx_t_36 < 0) {
14407  __pyx_t_36 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
14408  if (unlikely(__pyx_t_36 < 0)) __pyx_t_34 = 1;
14409  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_34 = 1;
14410  if (unlikely(__pyx_t_34 != -1)) {
14411  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14412  __PYX_ERR(0, 656, __pyx_L1_error)
14413  }
14414  __pyx_t_37 = __pyx_v_ii;
14415  __pyx_t_34 = -1;
14416  if (__pyx_t_37 < 0) {
14417  __pyx_t_37 += __pyx_pybuffernd_a_up.diminfo[0].shape;
14418  if (unlikely(__pyx_t_37 < 0)) __pyx_t_34 = 0;
14419  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_34 = 0;
14420  if (unlikely(__pyx_t_34 != -1)) {
14421  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14422  __PYX_ERR(0, 656, __pyx_L1_error)
14423  }
14424  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
14425  }
14426 
14427  /* "subsurfaceTransportFunctions.pyx":657
14428  * for ii in range(nnz):
14429  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14430  * for I in range(nSpace): # <<<<<<<<<<<<<<
14431  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
14432  * #
14433  */
14434  __pyx_t_28 = __pyx_v_nSpace;
14435  __pyx_t_29 = __pyx_t_28;
14436  for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) {
14437  __pyx_v_I = __pyx_t_30;
14438 
14439  /* "subsurfaceTransportFunctions.pyx":658
14440  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14441  * for I in range(nSpace):
14442  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
14443  * #
14444  *
14445  */
14446  __pyx_t_38 = __pyx_v_eN;
14447  __pyx_t_39 = __pyx_v_ebN;
14448  __pyx_t_40 = __pyx_v_I;
14449  __pyx_t_34 = -1;
14450  if (__pyx_t_38 < 0) {
14451  __pyx_t_38 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
14452  if (unlikely(__pyx_t_38 < 0)) __pyx_t_34 = 0;
14453  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_34 = 0;
14454  if (__pyx_t_39 < 0) {
14455  __pyx_t_39 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
14456  if (unlikely(__pyx_t_39 < 0)) __pyx_t_34 = 1;
14457  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_34 = 1;
14458  if (__pyx_t_40 < 0) {
14459  __pyx_t_40 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
14460  if (unlikely(__pyx_t_40 < 0)) __pyx_t_34 = 2;
14461  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_34 = 2;
14462  if (unlikely(__pyx_t_34 != -1)) {
14463  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14464  __PYX_ERR(0, 658, __pyx_L1_error)
14465  }
14466  __pyx_t_41 = __pyx_v_eN;
14467  __pyx_t_42 = __pyx_v_ebN;
14468  __pyx_t_34 = -1;
14469  if (__pyx_t_41 < 0) {
14470  __pyx_t_41 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
14471  if (unlikely(__pyx_t_41 < 0)) __pyx_t_34 = 0;
14472  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_34 = 0;
14473  if (__pyx_t_42 < 0) {
14474  __pyx_t_42 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
14475  if (unlikely(__pyx_t_42 < 0)) __pyx_t_34 = 1;
14476  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_34 = 1;
14477  if (unlikely(__pyx_t_34 != -1)) {
14478  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14479  __PYX_ERR(0, 658, __pyx_L1_error)
14480  }
14481  __pyx_t_43 = __pyx_v_I;
14482  __pyx_t_34 = -1;
14483  if (__pyx_t_43 < 0) {
14484  __pyx_t_43 += __pyx_pybuffernd_f_up.diminfo[0].shape;
14485  if (unlikely(__pyx_t_43 < 0)) __pyx_t_34 = 0;
14486  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_34 = 0;
14487  if (unlikely(__pyx_t_34 != -1)) {
14488  __Pyx_RaiseBufferIndexError(__pyx_t_34);
14489  __PYX_ERR(0, 658, __pyx_L1_error)
14490  }
14491  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_40, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
14492  }
14493 
14494  /* "subsurfaceTransportFunctions.pyx":662
14495  *
14496  * #Picard part first
14497  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
14498  * for I in range(nSpace):
14499  * for ii in range(rowptr[I],rowptr[I+1]):
14500  */
14501  __pyx_t_28 = __pyx_v_nDOF_trial_element;
14502  __pyx_t_29 = __pyx_t_28;
14503  for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) {
14504  __pyx_v_j = __pyx_t_30;
14505 
14506  /* "subsurfaceTransportFunctions.pyx":663
14507  * #Picard part first
14508  * for j in range(nDOF_trial_element):
14509  * for I in range(nSpace): # <<<<<<<<<<<<<<
14510  * for ii in range(rowptr[I],rowptr[I+1]):
14511  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
14512  */
14513  __pyx_t_34 = __pyx_v_nSpace;
14514  __pyx_t_44 = __pyx_t_34;
14515  for (__pyx_t_45 = 0; __pyx_t_45 < __pyx_t_44; __pyx_t_45+=1) {
14516  __pyx_v_I = __pyx_t_45;
14517 
14518  /* "subsurfaceTransportFunctions.pyx":664
14519  * for j in range(nDOF_trial_element):
14520  * for I in range(nSpace):
14521  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
14522  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
14523  * #j picard
14524  */
14525  __pyx_t_46 = (__pyx_v_I + 1);
14526  __pyx_t_47 = -1;
14527  if (__pyx_t_46 < 0) {
14528  __pyx_t_46 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14529  if (unlikely(__pyx_t_46 < 0)) __pyx_t_47 = 0;
14530  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_47 = 0;
14531  if (unlikely(__pyx_t_47 != -1)) {
14532  __Pyx_RaiseBufferIndexError(__pyx_t_47);
14533  __PYX_ERR(0, 664, __pyx_L1_error)
14534  }
14535  __pyx_t_48 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_rowptr.diminfo[0].strides));
14536  __pyx_t_49 = __pyx_v_I;
14537  __pyx_t_47 = -1;
14538  if (__pyx_t_49 < 0) {
14539  __pyx_t_49 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14540  if (unlikely(__pyx_t_49 < 0)) __pyx_t_47 = 0;
14541  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_47 = 0;
14542  if (unlikely(__pyx_t_47 != -1)) {
14543  __Pyx_RaiseBufferIndexError(__pyx_t_47);
14544  __PYX_ERR(0, 664, __pyx_L1_error)
14545  }
14546  __pyx_t_50 = __pyx_t_48;
14547  for (__pyx_t_47 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_47 < __pyx_t_50; __pyx_t_47+=1) {
14548  __pyx_v_ii = __pyx_t_47;
14549 
14550  /* "subsurfaceTransportFunctions.pyx":665
14551  * for I in range(nSpace):
14552  * for ii in range(rowptr[I],rowptr[I+1]):
14553  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
14554  * #j picard
14555  * #i
14556  */
14557  __pyx_t_51 = __pyx_v_ii;
14558  __pyx_t_52 = -1;
14559  if (__pyx_t_51 < 0) {
14560  __pyx_t_51 += __pyx_pybuffernd_a_up.diminfo[0].shape;
14561  if (unlikely(__pyx_t_51 < 0)) __pyx_t_52 = 0;
14562  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_52 = 0;
14563  if (unlikely(__pyx_t_52 != -1)) {
14564  __Pyx_RaiseBufferIndexError(__pyx_t_52);
14565  __PYX_ERR(0, 665, __pyx_L1_error)
14566  }
14567  __pyx_t_53 = __pyx_v_ii;
14568  __pyx_t_52 = -1;
14569  if (__pyx_t_53 < 0) {
14570  __pyx_t_53 += __pyx_pybuffernd_colind.diminfo[0].shape;
14571  if (unlikely(__pyx_t_53 < 0)) __pyx_t_52 = 0;
14572  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_52 = 0;
14573  if (unlikely(__pyx_t_52 != -1)) {
14574  __Pyx_RaiseBufferIndexError(__pyx_t_52);
14575  __PYX_ERR(0, 665, __pyx_L1_error)
14576  }
14577  __pyx_t_54 = __pyx_v_eN;
14578  __pyx_t_55 = __pyx_v_ebN;
14579  __pyx_t_56 = __pyx_v_j;
14580  __pyx_t_57 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_colind.diminfo[0].strides));
14581  __pyx_t_52 = -1;
14582  if (__pyx_t_54 < 0) {
14583  __pyx_t_54 += __pyx_pybuffernd_q_grad_v.diminfo[0].shape;
14584  if (unlikely(__pyx_t_54 < 0)) __pyx_t_52 = 0;
14585  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_q_grad_v.diminfo[0].shape)) __pyx_t_52 = 0;
14586  if (__pyx_t_55 < 0) {
14587  __pyx_t_55 += __pyx_pybuffernd_q_grad_v.diminfo[1].shape;
14588  if (unlikely(__pyx_t_55 < 0)) __pyx_t_52 = 1;
14589  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_q_grad_v.diminfo[1].shape)) __pyx_t_52 = 1;
14590  if (__pyx_t_56 < 0) {
14591  __pyx_t_56 += __pyx_pybuffernd_q_grad_v.diminfo[2].shape;
14592  if (unlikely(__pyx_t_56 < 0)) __pyx_t_52 = 2;
14593  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_q_grad_v.diminfo[2].shape)) __pyx_t_52 = 2;
14594  if (__pyx_t_57 < 0) {
14595  __pyx_t_57 += __pyx_pybuffernd_q_grad_v.diminfo[3].shape;
14596  if (unlikely(__pyx_t_57 < 0)) __pyx_t_52 = 3;
14597  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_q_grad_v.diminfo[3].shape)) __pyx_t_52 = 3;
14598  if (unlikely(__pyx_t_52 != -1)) {
14599  __Pyx_RaiseBufferIndexError(__pyx_t_52);
14600  __PYX_ERR(0, 665, __pyx_L1_error)
14601  }
14602  __pyx_t_58 = __pyx_v_eN;
14603  __pyx_t_59 = __pyx_v_ebN;
14604  __pyx_t_60 = __pyx_v_i;
14605  __pyx_t_61 = __pyx_v_I;
14606  __pyx_t_52 = -1;
14607  if (__pyx_t_58 < 0) {
14608  __pyx_t_58 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
14609  if (unlikely(__pyx_t_58 < 0)) __pyx_t_52 = 0;
14610  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_52 = 0;
14611  if (__pyx_t_59 < 0) {
14612  __pyx_t_59 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
14613  if (unlikely(__pyx_t_59 < 0)) __pyx_t_52 = 1;
14614  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_52 = 1;
14615  if (__pyx_t_60 < 0) {
14616  __pyx_t_60 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
14617  if (unlikely(__pyx_t_60 < 0)) __pyx_t_52 = 2;
14618  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_52 = 2;
14619  if (__pyx_t_61 < 0) {
14620  __pyx_t_61 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
14621  if (unlikely(__pyx_t_61 < 0)) __pyx_t_52 = 3;
14622  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_52 = 3;
14623  if (unlikely(__pyx_t_52 != -1)) {
14624  __Pyx_RaiseBufferIndexError(__pyx_t_52);
14625  __PYX_ERR(0, 665, __pyx_L1_error)
14626  }
14627  __pyx_t_62 = __pyx_v_eN;
14628  __pyx_t_63 = __pyx_v_i;
14629  __pyx_t_64 = __pyx_v_j;
14630  __pyx_t_52 = -1;
14631  if (__pyx_t_62 < 0) {
14632  __pyx_t_62 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
14633  if (unlikely(__pyx_t_62 < 0)) __pyx_t_52 = 0;
14634  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_52 = 0;
14635  if (__pyx_t_63 < 0) {
14636  __pyx_t_63 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
14637  if (unlikely(__pyx_t_63 < 0)) __pyx_t_52 = 1;
14638  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_52 = 1;
14639  if (__pyx_t_64 < 0) {
14640  __pyx_t_64 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
14641  if (unlikely(__pyx_t_64 < 0)) __pyx_t_52 = 2;
14642  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_52 = 2;
14643  if (unlikely(__pyx_t_52 != -1)) {
14644  __Pyx_RaiseBufferIndexError(__pyx_t_52);
14645  __PYX_ERR(0, 665, __pyx_L1_error)
14646  }
14647  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_64, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_q_grad_v.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_q_grad_v.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_q_grad_v.diminfo[2].strides, __pyx_t_57, __pyx_pybuffernd_q_grad_v.diminfo[3].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_60, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_61, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
14648  }
14649  }
14650  }
14651  }
14652  }
14653  }
14654 
14655  /* "subsurfaceTransportFunctions.pyx":574
14656  * #i
14657  * #eN
14658  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
14659  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
14660  * numpy.ndarray[ITYPE_t,ndim=1] colind,
14661  */
14662 
14663  /* function exit code */
14664  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14665  goto __pyx_L0;
14666  __pyx_L1_error:;
14667  __Pyx_XDECREF(__pyx_t_1);
14668  __Pyx_XDECREF(__pyx_t_2);
14669  __Pyx_XDECREF(__pyx_t_4);
14670  __Pyx_XDECREF(__pyx_t_5);
14671  __Pyx_XDECREF(__pyx_t_9);
14672  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
14673  __Pyx_PyThreadState_declare
14674  __Pyx_PyThreadState_assign
14675  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
14676  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14677  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14678  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14679  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14680  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14681  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14682  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14683  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14684  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14685  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14686  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14687  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14688  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14689  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14690  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14691  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14692  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14693  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14694  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14695  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14696  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14697  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14698  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14699  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
14700  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
14701  __pyx_r = NULL;
14702  goto __pyx_L2;
14703  __pyx_L0:;
14704  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14705  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14706  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14707  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14708  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14709  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14710  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14711  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14712  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14713  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14714  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14715  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14716  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14717  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14718  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14719  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14720  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14721  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14722  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14723  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14724  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14725  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14726  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14727  __pyx_L2:;
14728  __Pyx_XDECREF(__pyx_v_q);
14729  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
14730  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
14731  __Pyx_XGIVEREF(__pyx_r);
14732  __Pyx_RefNannyFinishContext();
14733  return __pyx_r;
14734 }
14735 
14736 /* "subsurfaceTransportFunctions.pyx":673
14737  * ##################################################
14738  *
14739  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
14740  * numpy.ndarray[DTYPE_t,ndim=3] w,
14741  * numpy.ndarray[DTYPE_t,ndim=2] dV,
14742  */
14743 
14744 /* Python wrapper */
14745 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14746 static char __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg[] = "\n approximate element mass term as (\010ar{c}_e,w_{h,i})_e\n ";
14747 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg = {"updateMass_weakAvg", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg};
14748 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14749  PyArrayObject *__pyx_v_mt = 0;
14750  PyArrayObject *__pyx_v_w = 0;
14751  PyArrayObject *__pyx_v_dV = 0;
14752  PyArrayObject *__pyx_v_weak_residual = 0;
14753  PyObject *__pyx_r = 0;
14754  __Pyx_RefNannyDeclarations
14755  __Pyx_RefNannySetupContext("updateMass_weakAvg (wrapper)", 0);
14756  {
14757  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mt,&__pyx_n_s_w,&__pyx_n_s_dV,&__pyx_n_s_weak_residual,0};
14758  PyObject* values[4] = {0,0,0,0};
14759  if (unlikely(__pyx_kwds)) {
14760  Py_ssize_t kw_args;
14761  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14762  switch (pos_args) {
14763  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14764  CYTHON_FALLTHROUGH;
14765  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14766  CYTHON_FALLTHROUGH;
14767  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14768  CYTHON_FALLTHROUGH;
14769  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14770  CYTHON_FALLTHROUGH;
14771  case 0: break;
14772  default: goto __pyx_L5_argtuple_error;
14773  }
14774  kw_args = PyDict_Size(__pyx_kwds);
14775  switch (pos_args) {
14776  case 0:
14777  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
14778  else goto __pyx_L5_argtuple_error;
14779  CYTHON_FALLTHROUGH;
14780  case 1:
14781  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
14782  else {
14783  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 1); __PYX_ERR(0, 673, __pyx_L3_error)
14784  }
14785  CYTHON_FALLTHROUGH;
14786  case 2:
14787  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
14788  else {
14789  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 2); __PYX_ERR(0, 673, __pyx_L3_error)
14790  }
14791  CYTHON_FALLTHROUGH;
14792  case 3:
14793  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weak_residual)) != 0)) kw_args--;
14794  else {
14795  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 3); __PYX_ERR(0, 673, __pyx_L3_error)
14796  }
14797  }
14798  if (unlikely(kw_args > 0)) {
14799  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMass_weakAvg") < 0)) __PYX_ERR(0, 673, __pyx_L3_error)
14800  }
14801  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
14802  goto __pyx_L5_argtuple_error;
14803  } else {
14804  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14805  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14806  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14807  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14808  }
14809  __pyx_v_mt = ((PyArrayObject *)values[0]);
14810  __pyx_v_w = ((PyArrayObject *)values[1]);
14811  __pyx_v_dV = ((PyArrayObject *)values[2]);
14812  __pyx_v_weak_residual = ((PyArrayObject *)values[3]);
14813  }
14814  goto __pyx_L4_argument_unpacking_done;
14815  __pyx_L5_argtuple_error:;
14816  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 673, __pyx_L3_error)
14817  __pyx_L3_error:;
14818  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
14819  __Pyx_RefNannyFinishContext();
14820  return NULL;
14821  __pyx_L4_argument_unpacking_done:;
14822  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mt), __pyx_ptype_5numpy_ndarray, 1, "mt", 0))) __PYX_ERR(0, 673, __pyx_L1_error)
14823  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 674, __pyx_L1_error)
14824  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 675, __pyx_L1_error)
14825  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "weak_residual", 0))) __PYX_ERR(0, 676, __pyx_L1_error)
14826  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(__pyx_self, __pyx_v_mt, __pyx_v_w, __pyx_v_dV, __pyx_v_weak_residual);
14827 
14828  /* function exit code */
14829  goto __pyx_L0;
14830  __pyx_L1_error:;
14831  __pyx_r = NULL;
14832  __pyx_L0:;
14833  __Pyx_RefNannyFinishContext();
14834  return __pyx_r;
14835 }
14836 
14837 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual) {
14838  int __pyx_v_eN;
14839  int __pyx_v_i;
14840  int __pyx_v_k;
14841  PyObject *__pyx_v_mt_avg = 0;
14842  PyObject *__pyx_v_vol = 0;
14843  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
14844  __Pyx_Buffer __pyx_pybuffer_dV;
14845  __Pyx_LocalBuf_ND __pyx_pybuffernd_mt;
14846  __Pyx_Buffer __pyx_pybuffer_mt;
14847  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
14848  __Pyx_Buffer __pyx_pybuffer_w;
14849  __Pyx_LocalBuf_ND __pyx_pybuffernd_weak_residual;
14850  __Pyx_Buffer __pyx_pybuffer_weak_residual;
14851  PyObject *__pyx_r = NULL;
14852  __Pyx_RefNannyDeclarations
14853  npy_intp __pyx_t_1;
14854  npy_intp __pyx_t_2;
14855  int __pyx_t_3;
14856  npy_intp __pyx_t_4;
14857  npy_intp __pyx_t_5;
14858  int __pyx_t_6;
14859  Py_ssize_t __pyx_t_7;
14860  Py_ssize_t __pyx_t_8;
14861  int __pyx_t_9;
14862  Py_ssize_t __pyx_t_10;
14863  Py_ssize_t __pyx_t_11;
14864  PyObject *__pyx_t_12 = NULL;
14865  PyObject *__pyx_t_13 = NULL;
14866  Py_ssize_t __pyx_t_14;
14867  Py_ssize_t __pyx_t_15;
14868  Py_ssize_t __pyx_t_16;
14869  Py_ssize_t __pyx_t_17;
14870  Py_ssize_t __pyx_t_18;
14871  Py_ssize_t __pyx_t_19;
14872  Py_ssize_t __pyx_t_20;
14873  PyObject *__pyx_t_21 = NULL;
14874  double __pyx_t_22;
14875  Py_ssize_t __pyx_t_23;
14876  Py_ssize_t __pyx_t_24;
14877  __Pyx_RefNannySetupContext("updateMass_weakAvg", 0);
14878  __pyx_pybuffer_mt.pybuffer.buf = NULL;
14879  __pyx_pybuffer_mt.refcount = 0;
14880  __pyx_pybuffernd_mt.data = NULL;
14881  __pyx_pybuffernd_mt.rcbuffer = &__pyx_pybuffer_mt;
14882  __pyx_pybuffer_w.pybuffer.buf = NULL;
14883  __pyx_pybuffer_w.refcount = 0;
14884  __pyx_pybuffernd_w.data = NULL;
14885  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
14886  __pyx_pybuffer_dV.pybuffer.buf = NULL;
14887  __pyx_pybuffer_dV.refcount = 0;
14888  __pyx_pybuffernd_dV.data = NULL;
14889  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
14890  __pyx_pybuffer_weak_residual.pybuffer.buf = NULL;
14891  __pyx_pybuffer_weak_residual.refcount = 0;
14892  __pyx_pybuffernd_weak_residual.data = NULL;
14893  __pyx_pybuffernd_weak_residual.rcbuffer = &__pyx_pybuffer_weak_residual;
14894  {
14895  __Pyx_BufFmt_StackElem __pyx_stack[1];
14896  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14897  }
14898  __pyx_pybuffernd_mt.diminfo[0].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mt.diminfo[0].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mt.diminfo[1].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mt.diminfo[1].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[1];
14899  {
14900  __Pyx_BufFmt_StackElem __pyx_stack[1];
14901  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14902  }
14903  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
14904  {
14905  __Pyx_BufFmt_StackElem __pyx_stack[1];
14906  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14907  }
14908  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
14909  {
14910  __Pyx_BufFmt_StackElem __pyx_stack[1];
14911  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14912  }
14913  __pyx_pybuffernd_weak_residual.diminfo[0].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weak_residual.diminfo[0].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_weak_residual.diminfo[1].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_weak_residual.diminfo[1].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[1];
14914 
14915  /* "subsurfaceTransportFunctions.pyx":682
14916  * cdef int eN,i,k
14917  * cdef mt_avg,vol
14918  * for eN in range(mt.shape[0]): # <<<<<<<<<<<<<<
14919  * mt_avg = 0.0
14920  * vol = 0.0
14921  */
14922  __pyx_t_1 = (__pyx_v_mt->dimensions[0]);
14923  __pyx_t_2 = __pyx_t_1;
14924  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
14925  __pyx_v_eN = __pyx_t_3;
14926 
14927  /* "subsurfaceTransportFunctions.pyx":683
14928  * cdef mt_avg,vol
14929  * for eN in range(mt.shape[0]):
14930  * mt_avg = 0.0 # <<<<<<<<<<<<<<
14931  * vol = 0.0
14932  * for k in range(mt.shape[1]):
14933  */
14934  __Pyx_INCREF(__pyx_float_0_0);
14935  __Pyx_XDECREF_SET(__pyx_v_mt_avg, __pyx_float_0_0);
14936 
14937  /* "subsurfaceTransportFunctions.pyx":684
14938  * for eN in range(mt.shape[0]):
14939  * mt_avg = 0.0
14940  * vol = 0.0 # <<<<<<<<<<<<<<
14941  * for k in range(mt.shape[1]):
14942  * mt_avg += dV[eN,k]*mt[eN,k]
14943  */
14944  __Pyx_INCREF(__pyx_float_0_0);
14945  __Pyx_XDECREF_SET(__pyx_v_vol, __pyx_float_0_0);
14946 
14947  /* "subsurfaceTransportFunctions.pyx":685
14948  * mt_avg = 0.0
14949  * vol = 0.0
14950  * for k in range(mt.shape[1]): # <<<<<<<<<<<<<<
14951  * mt_avg += dV[eN,k]*mt[eN,k]
14952  * vol += dV[eN,k]
14953  */
14954  __pyx_t_4 = (__pyx_v_mt->dimensions[1]);
14955  __pyx_t_5 = __pyx_t_4;
14956  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
14957  __pyx_v_k = __pyx_t_6;
14958 
14959  /* "subsurfaceTransportFunctions.pyx":686
14960  * vol = 0.0
14961  * for k in range(mt.shape[1]):
14962  * mt_avg += dV[eN,k]*mt[eN,k] # <<<<<<<<<<<<<<
14963  * vol += dV[eN,k]
14964  * mt_avg /= vol
14965  */
14966  __pyx_t_7 = __pyx_v_eN;
14967  __pyx_t_8 = __pyx_v_k;
14968  __pyx_t_9 = -1;
14969  if (__pyx_t_7 < 0) {
14970  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
14971  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
14972  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
14973  if (__pyx_t_8 < 0) {
14974  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
14975  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
14976  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
14977  if (unlikely(__pyx_t_9 != -1)) {
14978  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14979  __PYX_ERR(0, 686, __pyx_L1_error)
14980  }
14981  __pyx_t_10 = __pyx_v_eN;
14982  __pyx_t_11 = __pyx_v_k;
14983  __pyx_t_9 = -1;
14984  if (__pyx_t_10 < 0) {
14985  __pyx_t_10 += __pyx_pybuffernd_mt.diminfo[0].shape;
14986  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
14987  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_mt.diminfo[0].shape)) __pyx_t_9 = 0;
14988  if (__pyx_t_11 < 0) {
14989  __pyx_t_11 += __pyx_pybuffernd_mt.diminfo[1].shape;
14990  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
14991  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_mt.diminfo[1].shape)) __pyx_t_9 = 1;
14992  if (unlikely(__pyx_t_9 != -1)) {
14993  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14994  __PYX_ERR(0, 686, __pyx_L1_error)
14995  }
14996  __pyx_t_12 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_mt.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_mt.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_mt.diminfo[1].strides)))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 686, __pyx_L1_error)
14997  __Pyx_GOTREF(__pyx_t_12);
14998  __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_v_mt_avg, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 686, __pyx_L1_error)
14999  __Pyx_GOTREF(__pyx_t_13);
15000  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15001  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_13);
15002  __pyx_t_13 = 0;
15003 
15004  /* "subsurfaceTransportFunctions.pyx":687
15005  * for k in range(mt.shape[1]):
15006  * mt_avg += dV[eN,k]*mt[eN,k]
15007  * vol += dV[eN,k] # <<<<<<<<<<<<<<
15008  * mt_avg /= vol
15009  * for i in range(weak_residual.shape[1]):
15010  */
15011  __pyx_t_14 = __pyx_v_eN;
15012  __pyx_t_15 = __pyx_v_k;
15013  __pyx_t_9 = -1;
15014  if (__pyx_t_14 < 0) {
15015  __pyx_t_14 += __pyx_pybuffernd_dV.diminfo[0].shape;
15016  if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0;
15017  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15018  if (__pyx_t_15 < 0) {
15019  __pyx_t_15 += __pyx_pybuffernd_dV.diminfo[1].shape;
15020  if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 1;
15021  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15022  if (unlikely(__pyx_t_9 != -1)) {
15023  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15024  __PYX_ERR(0, 687, __pyx_L1_error)
15025  }
15026  __pyx_t_13 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 687, __pyx_L1_error)
15027  __Pyx_GOTREF(__pyx_t_13);
15028  __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_v_vol, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 687, __pyx_L1_error)
15029  __Pyx_GOTREF(__pyx_t_12);
15030  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15031  __Pyx_DECREF_SET(__pyx_v_vol, __pyx_t_12);
15032  __pyx_t_12 = 0;
15033  }
15034 
15035  /* "subsurfaceTransportFunctions.pyx":688
15036  * mt_avg += dV[eN,k]*mt[eN,k]
15037  * vol += dV[eN,k]
15038  * mt_avg /= vol # <<<<<<<<<<<<<<
15039  * for i in range(weak_residual.shape[1]):
15040  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15041  */
15042  __pyx_t_12 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mt_avg, __pyx_v_vol); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 688, __pyx_L1_error)
15043  __Pyx_GOTREF(__pyx_t_12);
15044  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_12);
15045  __pyx_t_12 = 0;
15046 
15047  /* "subsurfaceTransportFunctions.pyx":689
15048  * vol += dV[eN,k]
15049  * mt_avg /= vol
15050  * for i in range(weak_residual.shape[1]): # <<<<<<<<<<<<<<
15051  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15052  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15053  */
15054  __pyx_t_4 = (__pyx_v_weak_residual->dimensions[1]);
15055  __pyx_t_5 = __pyx_t_4;
15056  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15057  __pyx_v_i = __pyx_t_6;
15058 
15059  /* "subsurfaceTransportFunctions.pyx":691
15060  * for i in range(weak_residual.shape[1]):
15061  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15062  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k]) # <<<<<<<<<<<<<<
15063  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt,
15064  * numpy.ndarray[DTYPE_t,ndim=3] w,
15065  */
15066  __pyx_t_16 = __pyx_v_eN;
15067  __pyx_t_17 = __pyx_v_k;
15068  __pyx_t_18 = __pyx_v_i;
15069  __pyx_t_9 = -1;
15070  if (__pyx_t_16 < 0) {
15071  __pyx_t_16 += __pyx_pybuffernd_w.diminfo[0].shape;
15072  if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
15073  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_9 = 0;
15074  if (__pyx_t_17 < 0) {
15075  __pyx_t_17 += __pyx_pybuffernd_w.diminfo[1].shape;
15076  if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 1;
15077  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_9 = 1;
15078  if (__pyx_t_18 < 0) {
15079  __pyx_t_18 += __pyx_pybuffernd_w.diminfo[2].shape;
15080  if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 2;
15081  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_9 = 2;
15082  if (unlikely(__pyx_t_9 != -1)) {
15083  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15084  __PYX_ERR(0, 691, __pyx_L1_error)
15085  }
15086  __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_w.diminfo[2].strides))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 691, __pyx_L1_error)
15087  __Pyx_GOTREF(__pyx_t_12);
15088  __pyx_t_13 = PyNumber_Multiply(__pyx_v_mt_avg, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 691, __pyx_L1_error)
15089  __Pyx_GOTREF(__pyx_t_13);
15090  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15091  __pyx_t_19 = __pyx_v_eN;
15092  __pyx_t_20 = __pyx_v_k;
15093  __pyx_t_9 = -1;
15094  if (__pyx_t_19 < 0) {
15095  __pyx_t_19 += __pyx_pybuffernd_dV.diminfo[0].shape;
15096  if (unlikely(__pyx_t_19 < 0)) __pyx_t_9 = 0;
15097  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15098  if (__pyx_t_20 < 0) {
15099  __pyx_t_20 += __pyx_pybuffernd_dV.diminfo[1].shape;
15100  if (unlikely(__pyx_t_20 < 0)) __pyx_t_9 = 1;
15101  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15102  if (unlikely(__pyx_t_9 != -1)) {
15103  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15104  __PYX_ERR(0, 691, __pyx_L1_error)
15105  }
15106  __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 691, __pyx_L1_error)
15107  __Pyx_GOTREF(__pyx_t_12);
15108  __pyx_t_21 = PyNumber_Multiply(__pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 691, __pyx_L1_error)
15109  __Pyx_GOTREF(__pyx_t_21);
15110  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15111  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15112  __pyx_t_22 = __Pyx_PyObject_AsDouble(__pyx_t_21); if (unlikely(__pyx_t_22 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error)
15113  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
15114  __pyx_t_23 = __pyx_v_eN;
15115  __pyx_t_24 = __pyx_v_i;
15116  __pyx_t_9 = -1;
15117  if (__pyx_t_23 < 0) {
15118  __pyx_t_23 += __pyx_pybuffernd_weak_residual.diminfo[0].shape;
15119  if (unlikely(__pyx_t_23 < 0)) __pyx_t_9 = 0;
15120  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_weak_residual.diminfo[0].shape)) __pyx_t_9 = 0;
15121  if (__pyx_t_24 < 0) {
15122  __pyx_t_24 += __pyx_pybuffernd_weak_residual.diminfo[1].shape;
15123  if (unlikely(__pyx_t_24 < 0)) __pyx_t_9 = 1;
15124  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_weak_residual.diminfo[1].shape)) __pyx_t_9 = 1;
15125  if (unlikely(__pyx_t_9 != -1)) {
15126  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15127  __PYX_ERR(0, 691, __pyx_L1_error)
15128  }
15129  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_weak_residual.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_weak_residual.diminfo[1].strides) += __pyx_t_22;
15130  }
15131  }
15132 
15133  /* "subsurfaceTransportFunctions.pyx":673
15134  * ##################################################
15135  *
15136  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
15137  * numpy.ndarray[DTYPE_t,ndim=3] w,
15138  * numpy.ndarray[DTYPE_t,ndim=2] dV,
15139  */
15140 
15141  /* function exit code */
15142  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15143  goto __pyx_L0;
15144  __pyx_L1_error:;
15145  __Pyx_XDECREF(__pyx_t_12);
15146  __Pyx_XDECREF(__pyx_t_13);
15147  __Pyx_XDECREF(__pyx_t_21);
15148  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15149  __Pyx_PyThreadState_declare
15150  __Pyx_PyThreadState_assign
15151  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15152  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15153  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
15154  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15155  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
15156  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15157  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15158  __pyx_r = NULL;
15159  goto __pyx_L2;
15160  __pyx_L0:;
15161  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15162  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
15163  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15164  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
15165  __pyx_L2:;
15166  __Pyx_XDECREF(__pyx_v_mt_avg);
15167  __Pyx_XDECREF(__pyx_v_vol);
15168  __Pyx_XGIVEREF(__pyx_r);
15169  __Pyx_RefNannyFinishContext();
15170  return __pyx_r;
15171 }
15172 
15173 /* "subsurfaceTransportFunctions.pyx":692
15174  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15175  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15176  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
15177  * numpy.ndarray[DTYPE_t,ndim=3] w,
15178  * numpy.ndarray[DTYPE_t,ndim=3] v,
15179  */
15180 
15181 /* Python wrapper */
15182 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15183 static char __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg[] = "\n approximate element mass Jacobian term as (\\pd{\010ar{c}_e}{u_j},w_{h,i})_e\n ";
15184 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg = {"updateMassJacobian_weakAvg", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg};
15185 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15186  PyArrayObject *__pyx_v_dmt = 0;
15187  PyArrayObject *__pyx_v_w = 0;
15188  PyArrayObject *__pyx_v_v = 0;
15189  PyArrayObject *__pyx_v_dV = 0;
15190  PyArrayObject *__pyx_v_jacobian_weak_residual = 0;
15191  PyObject *__pyx_r = 0;
15192  __Pyx_RefNannyDeclarations
15193  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg (wrapper)", 0);
15194  {
15195  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dmt,&__pyx_n_s_w,&__pyx_n_s_v,&__pyx_n_s_dV,&__pyx_n_s_jacobian_weak_residual,0};
15196  PyObject* values[5] = {0,0,0,0,0};
15197  if (unlikely(__pyx_kwds)) {
15198  Py_ssize_t kw_args;
15199  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15200  switch (pos_args) {
15201  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15202  CYTHON_FALLTHROUGH;
15203  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15204  CYTHON_FALLTHROUGH;
15205  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15206  CYTHON_FALLTHROUGH;
15207  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15208  CYTHON_FALLTHROUGH;
15209  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15210  CYTHON_FALLTHROUGH;
15211  case 0: break;
15212  default: goto __pyx_L5_argtuple_error;
15213  }
15214  kw_args = PyDict_Size(__pyx_kwds);
15215  switch (pos_args) {
15216  case 0:
15217  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dmt)) != 0)) kw_args--;
15218  else goto __pyx_L5_argtuple_error;
15219  CYTHON_FALLTHROUGH;
15220  case 1:
15221  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
15222  else {
15223  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 1); __PYX_ERR(0, 692, __pyx_L3_error)
15224  }
15225  CYTHON_FALLTHROUGH;
15226  case 2:
15227  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15228  else {
15229  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 2); __PYX_ERR(0, 692, __pyx_L3_error)
15230  }
15231  CYTHON_FALLTHROUGH;
15232  case 3:
15233  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
15234  else {
15235  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 3); __PYX_ERR(0, 692, __pyx_L3_error)
15236  }
15237  CYTHON_FALLTHROUGH;
15238  case 4:
15239  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_jacobian_weak_residual)) != 0)) kw_args--;
15240  else {
15241  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 4); __PYX_ERR(0, 692, __pyx_L3_error)
15242  }
15243  }
15244  if (unlikely(kw_args > 0)) {
15245  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMassJacobian_weakAvg") < 0)) __PYX_ERR(0, 692, __pyx_L3_error)
15246  }
15247  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
15248  goto __pyx_L5_argtuple_error;
15249  } else {
15250  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15251  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15252  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15253  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15254  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15255  }
15256  __pyx_v_dmt = ((PyArrayObject *)values[0]);
15257  __pyx_v_w = ((PyArrayObject *)values[1]);
15258  __pyx_v_v = ((PyArrayObject *)values[2]);
15259  __pyx_v_dV = ((PyArrayObject *)values[3]);
15260  __pyx_v_jacobian_weak_residual = ((PyArrayObject *)values[4]);
15261  }
15262  goto __pyx_L4_argument_unpacking_done;
15263  __pyx_L5_argtuple_error:;
15264  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 692, __pyx_L3_error)
15265  __pyx_L3_error:;
15266  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15267  __Pyx_RefNannyFinishContext();
15268  return NULL;
15269  __pyx_L4_argument_unpacking_done:;
15270  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dmt), __pyx_ptype_5numpy_ndarray, 1, "dmt", 0))) __PYX_ERR(0, 692, __pyx_L1_error)
15271  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 693, __pyx_L1_error)
15272  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 694, __pyx_L1_error)
15273  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 695, __pyx_L1_error)
15274  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_jacobian_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "jacobian_weak_residual", 0))) __PYX_ERR(0, 696, __pyx_L1_error)
15275  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(__pyx_self, __pyx_v_dmt, __pyx_v_w, __pyx_v_v, __pyx_v_dV, __pyx_v_jacobian_weak_residual);
15276 
15277  /* function exit code */
15278  goto __pyx_L0;
15279  __pyx_L1_error:;
15280  __pyx_r = NULL;
15281  __pyx_L0:;
15282  __Pyx_RefNannyFinishContext();
15283  return __pyx_r;
15284 }
15285 
15286 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual) {
15287  int __pyx_v_eN;
15288  int __pyx_v_i;
15289  int __pyx_v_j;
15290  int __pyx_v_k;
15291  double __pyx_v_dmtj_avg;
15292  double __pyx_v_vol;
15293  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
15294  __Pyx_Buffer __pyx_pybuffer_dV;
15295  __Pyx_LocalBuf_ND __pyx_pybuffernd_dmt;
15296  __Pyx_Buffer __pyx_pybuffer_dmt;
15297  __Pyx_LocalBuf_ND __pyx_pybuffernd_jacobian_weak_residual;
15298  __Pyx_Buffer __pyx_pybuffer_jacobian_weak_residual;
15299  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15300  __Pyx_Buffer __pyx_pybuffer_v;
15301  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
15302  __Pyx_Buffer __pyx_pybuffer_w;
15303  PyObject *__pyx_r = NULL;
15304  __Pyx_RefNannyDeclarations
15305  npy_intp __pyx_t_1;
15306  npy_intp __pyx_t_2;
15307  int __pyx_t_3;
15308  npy_intp __pyx_t_4;
15309  npy_intp __pyx_t_5;
15310  int __pyx_t_6;
15311  Py_ssize_t __pyx_t_7;
15312  Py_ssize_t __pyx_t_8;
15313  int __pyx_t_9;
15314  npy_intp __pyx_t_10;
15315  npy_intp __pyx_t_11;
15316  npy_intp __pyx_t_12;
15317  npy_intp __pyx_t_13;
15318  int __pyx_t_14;
15319  Py_ssize_t __pyx_t_15;
15320  Py_ssize_t __pyx_t_16;
15321  int __pyx_t_17;
15322  Py_ssize_t __pyx_t_18;
15323  Py_ssize_t __pyx_t_19;
15324  Py_ssize_t __pyx_t_20;
15325  Py_ssize_t __pyx_t_21;
15326  Py_ssize_t __pyx_t_22;
15327  Py_ssize_t __pyx_t_23;
15328  Py_ssize_t __pyx_t_24;
15329  Py_ssize_t __pyx_t_25;
15330  Py_ssize_t __pyx_t_26;
15331  Py_ssize_t __pyx_t_27;
15332  Py_ssize_t __pyx_t_28;
15333  Py_ssize_t __pyx_t_29;
15334  Py_ssize_t __pyx_t_30;
15335  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg", 0);
15336  __pyx_pybuffer_dmt.pybuffer.buf = NULL;
15337  __pyx_pybuffer_dmt.refcount = 0;
15338  __pyx_pybuffernd_dmt.data = NULL;
15339  __pyx_pybuffernd_dmt.rcbuffer = &__pyx_pybuffer_dmt;
15340  __pyx_pybuffer_w.pybuffer.buf = NULL;
15341  __pyx_pybuffer_w.refcount = 0;
15342  __pyx_pybuffernd_w.data = NULL;
15343  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
15344  __pyx_pybuffer_v.pybuffer.buf = NULL;
15345  __pyx_pybuffer_v.refcount = 0;
15346  __pyx_pybuffernd_v.data = NULL;
15347  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15348  __pyx_pybuffer_dV.pybuffer.buf = NULL;
15349  __pyx_pybuffer_dV.refcount = 0;
15350  __pyx_pybuffernd_dV.data = NULL;
15351  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
15352  __pyx_pybuffer_jacobian_weak_residual.pybuffer.buf = NULL;
15353  __pyx_pybuffer_jacobian_weak_residual.refcount = 0;
15354  __pyx_pybuffernd_jacobian_weak_residual.data = NULL;
15355  __pyx_pybuffernd_jacobian_weak_residual.rcbuffer = &__pyx_pybuffer_jacobian_weak_residual;
15356  {
15357  __Pyx_BufFmt_StackElem __pyx_stack[1];
15358  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15359  }
15360  __pyx_pybuffernd_dmt.diminfo[0].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dmt.diminfo[0].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dmt.diminfo[1].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dmt.diminfo[1].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[1];
15361  {
15362  __Pyx_BufFmt_StackElem __pyx_stack[1];
15363  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15364  }
15365  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
15366  {
15367  __Pyx_BufFmt_StackElem __pyx_stack[1];
15368  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15369  }
15370  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
15371  {
15372  __Pyx_BufFmt_StackElem __pyx_stack[1];
15373  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15374  }
15375  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
15376  {
15377  __Pyx_BufFmt_StackElem __pyx_stack[1];
15378  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_jacobian_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15379  }
15380  __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[2];
15381 
15382  /* "subsurfaceTransportFunctions.pyx":702
15383  * cdef int eN,i,j,k
15384  * cdef double dmtj_avg,vol
15385  * for eN in range(dmt.shape[0]): # <<<<<<<<<<<<<<
15386  * vol = 0.0 #should I save a loop?
15387  * for k in range(dmt.shape[1]):
15388  */
15389  __pyx_t_1 = (__pyx_v_dmt->dimensions[0]);
15390  __pyx_t_2 = __pyx_t_1;
15391  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15392  __pyx_v_eN = __pyx_t_3;
15393 
15394  /* "subsurfaceTransportFunctions.pyx":703
15395  * cdef double dmtj_avg,vol
15396  * for eN in range(dmt.shape[0]):
15397  * vol = 0.0 #should I save a loop? # <<<<<<<<<<<<<<
15398  * for k in range(dmt.shape[1]):
15399  * vol += dV[eN,k]
15400  */
15401  __pyx_v_vol = 0.0;
15402 
15403  /* "subsurfaceTransportFunctions.pyx":704
15404  * for eN in range(dmt.shape[0]):
15405  * vol = 0.0 #should I save a loop?
15406  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
15407  * vol += dV[eN,k]
15408  * for i in range(w.shape[2]):
15409  */
15410  __pyx_t_4 = (__pyx_v_dmt->dimensions[1]);
15411  __pyx_t_5 = __pyx_t_4;
15412  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15413  __pyx_v_k = __pyx_t_6;
15414 
15415  /* "subsurfaceTransportFunctions.pyx":705
15416  * vol = 0.0 #should I save a loop?
15417  * for k in range(dmt.shape[1]):
15418  * vol += dV[eN,k] # <<<<<<<<<<<<<<
15419  * for i in range(w.shape[2]):
15420  * for j in range(v.shape[2]):
15421  */
15422  __pyx_t_7 = __pyx_v_eN;
15423  __pyx_t_8 = __pyx_v_k;
15424  __pyx_t_9 = -1;
15425  if (__pyx_t_7 < 0) {
15426  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
15427  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
15428  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15429  if (__pyx_t_8 < 0) {
15430  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
15431  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
15432  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15433  if (unlikely(__pyx_t_9 != -1)) {
15434  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15435  __PYX_ERR(0, 705, __pyx_L1_error)
15436  }
15437  __pyx_v_vol = (__pyx_v_vol + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
15438  }
15439 
15440  /* "subsurfaceTransportFunctions.pyx":706
15441  * for k in range(dmt.shape[1]):
15442  * vol += dV[eN,k]
15443  * for i in range(w.shape[2]): # <<<<<<<<<<<<<<
15444  * for j in range(v.shape[2]):
15445  * dmtj_avg = 0.0
15446  */
15447  __pyx_t_4 = (__pyx_v_w->dimensions[2]);
15448  __pyx_t_5 = __pyx_t_4;
15449  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15450  __pyx_v_i = __pyx_t_6;
15451 
15452  /* "subsurfaceTransportFunctions.pyx":707
15453  * vol += dV[eN,k]
15454  * for i in range(w.shape[2]):
15455  * for j in range(v.shape[2]): # <<<<<<<<<<<<<<
15456  * dmtj_avg = 0.0
15457  * for k in range(dmt.shape[1]):
15458  */
15459  __pyx_t_10 = (__pyx_v_v->dimensions[2]);
15460  __pyx_t_11 = __pyx_t_10;
15461  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
15462  __pyx_v_j = __pyx_t_9;
15463 
15464  /* "subsurfaceTransportFunctions.pyx":708
15465  * for i in range(w.shape[2]):
15466  * for j in range(v.shape[2]):
15467  * dmtj_avg = 0.0 # <<<<<<<<<<<<<<
15468  * for k in range(dmt.shape[1]):
15469  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15470  */
15471  __pyx_v_dmtj_avg = 0.0;
15472 
15473  /* "subsurfaceTransportFunctions.pyx":709
15474  * for j in range(v.shape[2]):
15475  * dmtj_avg = 0.0
15476  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
15477  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15478  * dmtj_avg /= vol
15479  */
15480  __pyx_t_12 = (__pyx_v_dmt->dimensions[1]);
15481  __pyx_t_13 = __pyx_t_12;
15482  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
15483  __pyx_v_k = __pyx_t_14;
15484 
15485  /* "subsurfaceTransportFunctions.pyx":710
15486  * dmtj_avg = 0.0
15487  * for k in range(dmt.shape[1]):
15488  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j] # <<<<<<<<<<<<<<
15489  * dmtj_avg /= vol
15490  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
15491  */
15492  __pyx_t_15 = __pyx_v_eN;
15493  __pyx_t_16 = __pyx_v_k;
15494  __pyx_t_17 = -1;
15495  if (__pyx_t_15 < 0) {
15496  __pyx_t_15 += __pyx_pybuffernd_dV.diminfo[0].shape;
15497  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0;
15498  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_17 = 0;
15499  if (__pyx_t_16 < 0) {
15500  __pyx_t_16 += __pyx_pybuffernd_dV.diminfo[1].shape;
15501  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
15502  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_17 = 1;
15503  if (unlikely(__pyx_t_17 != -1)) {
15504  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15505  __PYX_ERR(0, 710, __pyx_L1_error)
15506  }
15507  __pyx_t_18 = __pyx_v_eN;
15508  __pyx_t_19 = __pyx_v_k;
15509  __pyx_t_17 = -1;
15510  if (__pyx_t_18 < 0) {
15511  __pyx_t_18 += __pyx_pybuffernd_dmt.diminfo[0].shape;
15512  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
15513  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_dmt.diminfo[0].shape)) __pyx_t_17 = 0;
15514  if (__pyx_t_19 < 0) {
15515  __pyx_t_19 += __pyx_pybuffernd_dmt.diminfo[1].shape;
15516  if (unlikely(__pyx_t_19 < 0)) __pyx_t_17 = 1;
15517  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_dmt.diminfo[1].shape)) __pyx_t_17 = 1;
15518  if (unlikely(__pyx_t_17 != -1)) {
15519  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15520  __PYX_ERR(0, 710, __pyx_L1_error)
15521  }
15522  __pyx_t_20 = __pyx_v_eN;
15523  __pyx_t_21 = __pyx_v_k;
15524  __pyx_t_22 = __pyx_v_j;
15525  __pyx_t_17 = -1;
15526  if (__pyx_t_20 < 0) {
15527  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[0].shape;
15528  if (unlikely(__pyx_t_20 < 0)) __pyx_t_17 = 0;
15529  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_17 = 0;
15530  if (__pyx_t_21 < 0) {
15531  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[1].shape;
15532  if (unlikely(__pyx_t_21 < 0)) __pyx_t_17 = 1;
15533  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_17 = 1;
15534  if (__pyx_t_22 < 0) {
15535  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[2].shape;
15536  if (unlikely(__pyx_t_22 < 0)) __pyx_t_17 = 2;
15537  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_17 = 2;
15538  if (unlikely(__pyx_t_17 != -1)) {
15539  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15540  __PYX_ERR(0, 710, __pyx_L1_error)
15541  }
15542  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg + (((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dmt.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_dmt.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_dmt.diminfo[1].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[2].strides))));
15543  }
15544 
15545  /* "subsurfaceTransportFunctions.pyx":711
15546  * for k in range(dmt.shape[1]):
15547  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15548  * dmtj_avg /= vol # <<<<<<<<<<<<<<
15549  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
15550  *
15551  */
15552  if (unlikely(__pyx_v_vol == 0)) {
15553  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
15554  __PYX_ERR(0, 711, __pyx_L1_error)
15555  }
15556  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg / __pyx_v_vol);
15557 
15558  /* "subsurfaceTransportFunctions.pyx":712
15559  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15560  * dmtj_avg /= vol
15561  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k] # <<<<<<<<<<<<<<
15562  *
15563  * ########################################################################
15564  */
15565  __pyx_t_23 = __pyx_v_eN;
15566  __pyx_t_24 = __pyx_v_k;
15567  __pyx_t_25 = __pyx_v_i;
15568  __pyx_t_14 = -1;
15569  if (__pyx_t_23 < 0) {
15570  __pyx_t_23 += __pyx_pybuffernd_w.diminfo[0].shape;
15571  if (unlikely(__pyx_t_23 < 0)) __pyx_t_14 = 0;
15572  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_14 = 0;
15573  if (__pyx_t_24 < 0) {
15574  __pyx_t_24 += __pyx_pybuffernd_w.diminfo[1].shape;
15575  if (unlikely(__pyx_t_24 < 0)) __pyx_t_14 = 1;
15576  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_14 = 1;
15577  if (__pyx_t_25 < 0) {
15578  __pyx_t_25 += __pyx_pybuffernd_w.diminfo[2].shape;
15579  if (unlikely(__pyx_t_25 < 0)) __pyx_t_14 = 2;
15580  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_14 = 2;
15581  if (unlikely(__pyx_t_14 != -1)) {
15582  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15583  __PYX_ERR(0, 712, __pyx_L1_error)
15584  }
15585  __pyx_t_26 = __pyx_v_eN;
15586  __pyx_t_27 = __pyx_v_k;
15587  __pyx_t_14 = -1;
15588  if (__pyx_t_26 < 0) {
15589  __pyx_t_26 += __pyx_pybuffernd_dV.diminfo[0].shape;
15590  if (unlikely(__pyx_t_26 < 0)) __pyx_t_14 = 0;
15591  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_14 = 0;
15592  if (__pyx_t_27 < 0) {
15593  __pyx_t_27 += __pyx_pybuffernd_dV.diminfo[1].shape;
15594  if (unlikely(__pyx_t_27 < 0)) __pyx_t_14 = 1;
15595  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_14 = 1;
15596  if (unlikely(__pyx_t_14 != -1)) {
15597  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15598  __PYX_ERR(0, 712, __pyx_L1_error)
15599  }
15600  __pyx_t_28 = __pyx_v_eN;
15601  __pyx_t_29 = __pyx_v_i;
15602  __pyx_t_30 = __pyx_v_j;
15603  __pyx_t_14 = -1;
15604  if (__pyx_t_28 < 0) {
15605  __pyx_t_28 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape;
15606  if (unlikely(__pyx_t_28 < 0)) __pyx_t_14 = 0;
15607  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape)) __pyx_t_14 = 0;
15608  if (__pyx_t_29 < 0) {
15609  __pyx_t_29 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape;
15610  if (unlikely(__pyx_t_29 < 0)) __pyx_t_14 = 1;
15611  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape)) __pyx_t_14 = 1;
15612  if (__pyx_t_30 < 0) {
15613  __pyx_t_30 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape;
15614  if (unlikely(__pyx_t_30 < 0)) __pyx_t_14 = 2;
15615  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape)) __pyx_t_14 = 2;
15616  if (unlikely(__pyx_t_14 != -1)) {
15617  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15618  __PYX_ERR(0, 712, __pyx_L1_error)
15619  }
15620  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides) += ((__pyx_v_dmtj_avg * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_w.diminfo[2].strides))) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_dV.diminfo[1].strides)));
15621  }
15622  }
15623  }
15624 
15625  /* "subsurfaceTransportFunctions.pyx":692
15626  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15627  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15628  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
15629  * numpy.ndarray[DTYPE_t,ndim=3] w,
15630  * numpy.ndarray[DTYPE_t,ndim=3] v,
15631  */
15632 
15633  /* function exit code */
15634  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15635  goto __pyx_L0;
15636  __pyx_L1_error:;
15637  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15638  __Pyx_PyThreadState_declare
15639  __Pyx_PyThreadState_assign
15640  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15641  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15642  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15643  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15644  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15645  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15646  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15647  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15648  __pyx_r = NULL;
15649  goto __pyx_L2;
15650  __pyx_L0:;
15651  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15652  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15653  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15654  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15655  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15656  __pyx_L2:;
15657  __Pyx_XGIVEREF(__pyx_r);
15658  __Pyx_RefNannyFinishContext();
15659  return __pyx_r;
15660 }
15661 
15662 /* "subsurfaceTransportFunctions.pyx":717
15663  * #ELLAM
15664  * ########################################################################
15665  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
15666  * numpy.ndarray[DTYPE_t,ndim=4] n,
15667  * numpy.ndarray[DTYPE_t,ndim=3] dS,
15668  */
15669 
15670 /* Python wrapper */
15671 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15672 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux = {"calculateNormalFlux", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux, METH_VARARGS|METH_KEYWORDS, 0};
15673 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15674  PyArrayObject *__pyx_v_v = 0;
15675  PyArrayObject *__pyx_v_n = 0;
15676  PyArrayObject *__pyx_v_dS = 0;
15677  PyArrayObject *__pyx_v_flux = 0;
15678  PyObject *__pyx_r = 0;
15679  __Pyx_RefNannyDeclarations
15680  __Pyx_RefNannySetupContext("calculateNormalFlux (wrapper)", 0);
15681  {
15682  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_n,&__pyx_n_s_dS,&__pyx_n_s_flux,0};
15683  PyObject* values[4] = {0,0,0,0};
15684  if (unlikely(__pyx_kwds)) {
15685  Py_ssize_t kw_args;
15686  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15687  switch (pos_args) {
15688  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15689  CYTHON_FALLTHROUGH;
15690  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15691  CYTHON_FALLTHROUGH;
15692  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15693  CYTHON_FALLTHROUGH;
15694  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15695  CYTHON_FALLTHROUGH;
15696  case 0: break;
15697  default: goto __pyx_L5_argtuple_error;
15698  }
15699  kw_args = PyDict_Size(__pyx_kwds);
15700  switch (pos_args) {
15701  case 0:
15702  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15703  else goto __pyx_L5_argtuple_error;
15704  CYTHON_FALLTHROUGH;
15705  case 1:
15706  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
15707  else {
15708  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 1); __PYX_ERR(0, 717, __pyx_L3_error)
15709  }
15710  CYTHON_FALLTHROUGH;
15711  case 2:
15712  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dS)) != 0)) kw_args--;
15713  else {
15714  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 2); __PYX_ERR(0, 717, __pyx_L3_error)
15715  }
15716  CYTHON_FALLTHROUGH;
15717  case 3:
15718  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flux)) != 0)) kw_args--;
15719  else {
15720  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 3); __PYX_ERR(0, 717, __pyx_L3_error)
15721  }
15722  }
15723  if (unlikely(kw_args > 0)) {
15724  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNormalFlux") < 0)) __PYX_ERR(0, 717, __pyx_L3_error)
15725  }
15726  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
15727  goto __pyx_L5_argtuple_error;
15728  } else {
15729  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15730  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15731  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15732  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15733  }
15734  __pyx_v_v = ((PyArrayObject *)values[0]);
15735  __pyx_v_n = ((PyArrayObject *)values[1]);
15736  __pyx_v_dS = ((PyArrayObject *)values[2]);
15737  __pyx_v_flux = ((PyArrayObject *)values[3]);
15738  }
15739  goto __pyx_L4_argument_unpacking_done;
15740  __pyx_L5_argtuple_error:;
15741  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 717, __pyx_L3_error)
15742  __pyx_L3_error:;
15743  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
15744  __Pyx_RefNannyFinishContext();
15745  return NULL;
15746  __pyx_L4_argument_unpacking_done:;
15747  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 717, __pyx_L1_error)
15748  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 718, __pyx_L1_error)
15749  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dS), __pyx_ptype_5numpy_ndarray, 1, "dS", 0))) __PYX_ERR(0, 719, __pyx_L1_error)
15750  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_flux), __pyx_ptype_5numpy_ndarray, 1, "flux", 0))) __PYX_ERR(0, 720, __pyx_L1_error)
15751  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(__pyx_self, __pyx_v_v, __pyx_v_n, __pyx_v_dS, __pyx_v_flux);
15752 
15753  /* function exit code */
15754  goto __pyx_L0;
15755  __pyx_L1_error:;
15756  __pyx_r = NULL;
15757  __pyx_L0:;
15758  __Pyx_RefNannyFinishContext();
15759  return __pyx_r;
15760 }
15761 
15762 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux) {
15763  int __pyx_v_eN;
15764  int __pyx_v_ebN;
15765  int __pyx_v_kb;
15766  double __pyx_v_integral;
15767  npy_intp __pyx_v_I;
15768  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
15769  __Pyx_Buffer __pyx_pybuffer_dS;
15770  __Pyx_LocalBuf_ND __pyx_pybuffernd_flux;
15771  __Pyx_Buffer __pyx_pybuffer_flux;
15772  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
15773  __Pyx_Buffer __pyx_pybuffer_n;
15774  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15775  __Pyx_Buffer __pyx_pybuffer_v;
15776  PyObject *__pyx_r = NULL;
15777  __Pyx_RefNannyDeclarations
15778  npy_intp __pyx_t_1;
15779  npy_intp __pyx_t_2;
15780  int __pyx_t_3;
15781  npy_intp __pyx_t_4;
15782  npy_intp __pyx_t_5;
15783  int __pyx_t_6;
15784  npy_intp __pyx_t_7;
15785  npy_intp __pyx_t_8;
15786  int __pyx_t_9;
15787  npy_intp __pyx_t_10;
15788  npy_intp __pyx_t_11;
15789  npy_intp __pyx_t_12;
15790  Py_ssize_t __pyx_t_13;
15791  Py_ssize_t __pyx_t_14;
15792  Py_ssize_t __pyx_t_15;
15793  Py_ssize_t __pyx_t_16;
15794  int __pyx_t_17;
15795  Py_ssize_t __pyx_t_18;
15796  Py_ssize_t __pyx_t_19;
15797  Py_ssize_t __pyx_t_20;
15798  Py_ssize_t __pyx_t_21;
15799  Py_ssize_t __pyx_t_22;
15800  Py_ssize_t __pyx_t_23;
15801  Py_ssize_t __pyx_t_24;
15802  Py_ssize_t __pyx_t_25;
15803  Py_ssize_t __pyx_t_26;
15804  __Pyx_RefNannySetupContext("calculateNormalFlux", 0);
15805  __pyx_pybuffer_v.pybuffer.buf = NULL;
15806  __pyx_pybuffer_v.refcount = 0;
15807  __pyx_pybuffernd_v.data = NULL;
15808  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15809  __pyx_pybuffer_n.pybuffer.buf = NULL;
15810  __pyx_pybuffer_n.refcount = 0;
15811  __pyx_pybuffernd_n.data = NULL;
15812  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
15813  __pyx_pybuffer_dS.pybuffer.buf = NULL;
15814  __pyx_pybuffer_dS.refcount = 0;
15815  __pyx_pybuffernd_dS.data = NULL;
15816  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
15817  __pyx_pybuffer_flux.pybuffer.buf = NULL;
15818  __pyx_pybuffer_flux.refcount = 0;
15819  __pyx_pybuffernd_flux.data = NULL;
15820  __pyx_pybuffernd_flux.rcbuffer = &__pyx_pybuffer_flux;
15821  {
15822  __Pyx_BufFmt_StackElem __pyx_stack[1];
15823  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15824  }
15825  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
15826  {
15827  __Pyx_BufFmt_StackElem __pyx_stack[1];
15828  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15829  }
15830  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_n.diminfo[1].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_n.diminfo[1].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_n.diminfo[2].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_n.diminfo[2].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_n.diminfo[3].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_n.diminfo[3].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[3];
15831  {
15832  __Pyx_BufFmt_StackElem __pyx_stack[1];
15833  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15834  }
15835  __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dS.diminfo[1].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dS.diminfo[1].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_dS.diminfo[2].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_dS.diminfo[2].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[2];
15836  {
15837  __Pyx_BufFmt_StackElem __pyx_stack[1];
15838  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flux.rcbuffer->pybuffer, (PyObject*)__pyx_v_flux, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15839  }
15840  __pyx_pybuffernd_flux.diminfo[0].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flux.diminfo[0].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_flux.diminfo[1].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_flux.diminfo[1].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[1];
15841 
15842  /* "subsurfaceTransportFunctions.pyx":724
15843  * cdef int eN,ebN,kb
15844  * cdef double integral
15845  * for eN in range(n.shape[0]): # <<<<<<<<<<<<<<
15846  * for ebN in range(n.shape[1]):
15847  * integral = 0.0
15848  */
15849  __pyx_t_1 = (__pyx_v_n->dimensions[0]);
15850  __pyx_t_2 = __pyx_t_1;
15851  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15852  __pyx_v_eN = __pyx_t_3;
15853 
15854  /* "subsurfaceTransportFunctions.pyx":725
15855  * cdef double integral
15856  * for eN in range(n.shape[0]):
15857  * for ebN in range(n.shape[1]): # <<<<<<<<<<<<<<
15858  * integral = 0.0
15859  * for kb in range(n.shape[2]):
15860  */
15861  __pyx_t_4 = (__pyx_v_n->dimensions[1]);
15862  __pyx_t_5 = __pyx_t_4;
15863  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15864  __pyx_v_ebN = __pyx_t_6;
15865 
15866  /* "subsurfaceTransportFunctions.pyx":726
15867  * for eN in range(n.shape[0]):
15868  * for ebN in range(n.shape[1]):
15869  * integral = 0.0 # <<<<<<<<<<<<<<
15870  * for kb in range(n.shape[2]):
15871  * for I in range(n.shape[3]):
15872  */
15873  __pyx_v_integral = 0.0;
15874 
15875  /* "subsurfaceTransportFunctions.pyx":727
15876  * for ebN in range(n.shape[1]):
15877  * integral = 0.0
15878  * for kb in range(n.shape[2]): # <<<<<<<<<<<<<<
15879  * for I in range(n.shape[3]):
15880  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15881  */
15882  __pyx_t_7 = (__pyx_v_n->dimensions[2]);
15883  __pyx_t_8 = __pyx_t_7;
15884  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
15885  __pyx_v_kb = __pyx_t_9;
15886 
15887  /* "subsurfaceTransportFunctions.pyx":728
15888  * integral = 0.0
15889  * for kb in range(n.shape[2]):
15890  * for I in range(n.shape[3]): # <<<<<<<<<<<<<<
15891  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15892  * flux[eN,ebN] = integral
15893  */
15894  __pyx_t_10 = (__pyx_v_n->dimensions[3]);
15895  __pyx_t_11 = __pyx_t_10;
15896  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
15897  __pyx_v_I = __pyx_t_12;
15898 
15899  /* "subsurfaceTransportFunctions.pyx":729
15900  * for kb in range(n.shape[2]):
15901  * for I in range(n.shape[3]):
15902  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb] # <<<<<<<<<<<<<<
15903  * flux[eN,ebN] = integral
15904  *
15905  */
15906  __pyx_t_13 = __pyx_v_eN;
15907  __pyx_t_14 = __pyx_v_ebN;
15908  __pyx_t_15 = __pyx_v_kb;
15909  __pyx_t_16 = __pyx_v_I;
15910  __pyx_t_17 = -1;
15911  if (__pyx_t_13 < 0) {
15912  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[0].shape;
15913  if (unlikely(__pyx_t_13 < 0)) __pyx_t_17 = 0;
15914  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_17 = 0;
15915  if (__pyx_t_14 < 0) {
15916  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[1].shape;
15917  if (unlikely(__pyx_t_14 < 0)) __pyx_t_17 = 1;
15918  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_17 = 1;
15919  if (__pyx_t_15 < 0) {
15920  __pyx_t_15 += __pyx_pybuffernd_v.diminfo[2].shape;
15921  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 2;
15922  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_17 = 2;
15923  if (__pyx_t_16 < 0) {
15924  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
15925  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 3;
15926  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_17 = 3;
15927  if (unlikely(__pyx_t_17 != -1)) {
15928  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15929  __PYX_ERR(0, 729, __pyx_L1_error)
15930  }
15931  __pyx_t_18 = __pyx_v_eN;
15932  __pyx_t_19 = __pyx_v_ebN;
15933  __pyx_t_20 = __pyx_v_kb;
15934  __pyx_t_21 = __pyx_v_I;
15935  __pyx_t_17 = -1;
15936  if (__pyx_t_18 < 0) {
15937  __pyx_t_18 += __pyx_pybuffernd_n.diminfo[0].shape;
15938  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
15939  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
15940  if (__pyx_t_19 < 0) {
15941  __pyx_t_19 += __pyx_pybuffernd_n.diminfo[1].shape;
15942  if (unlikely(__pyx_t_19 < 0)) __pyx_t_17 = 1;
15943  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_n.diminfo[1].shape)) __pyx_t_17 = 1;
15944  if (__pyx_t_20 < 0) {
15945  __pyx_t_20 += __pyx_pybuffernd_n.diminfo[2].shape;
15946  if (unlikely(__pyx_t_20 < 0)) __pyx_t_17 = 2;
15947  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_n.diminfo[2].shape)) __pyx_t_17 = 2;
15948  if (__pyx_t_21 < 0) {
15949  __pyx_t_21 += __pyx_pybuffernd_n.diminfo[3].shape;
15950  if (unlikely(__pyx_t_21 < 0)) __pyx_t_17 = 3;
15951  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_n.diminfo[3].shape)) __pyx_t_17 = 3;
15952  if (unlikely(__pyx_t_17 != -1)) {
15953  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15954  __PYX_ERR(0, 729, __pyx_L1_error)
15955  }
15956  __pyx_t_22 = __pyx_v_eN;
15957  __pyx_t_23 = __pyx_v_ebN;
15958  __pyx_t_24 = __pyx_v_kb;
15959  __pyx_t_17 = -1;
15960  if (__pyx_t_22 < 0) {
15961  __pyx_t_22 += __pyx_pybuffernd_dS.diminfo[0].shape;
15962  if (unlikely(__pyx_t_22 < 0)) __pyx_t_17 = 0;
15963  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_dS.diminfo[0].shape)) __pyx_t_17 = 0;
15964  if (__pyx_t_23 < 0) {
15965  __pyx_t_23 += __pyx_pybuffernd_dS.diminfo[1].shape;
15966  if (unlikely(__pyx_t_23 < 0)) __pyx_t_17 = 1;
15967  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_dS.diminfo[1].shape)) __pyx_t_17 = 1;
15968  if (__pyx_t_24 < 0) {
15969  __pyx_t_24 += __pyx_pybuffernd_dS.diminfo[2].shape;
15970  if (unlikely(__pyx_t_24 < 0)) __pyx_t_17 = 2;
15971  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_dS.diminfo[2].shape)) __pyx_t_17 = 2;
15972  if (unlikely(__pyx_t_17 != -1)) {
15973  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15974  __PYX_ERR(0, 729, __pyx_L1_error)
15975  }
15976  __pyx_v_integral = (__pyx_v_integral + (((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides)) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_n.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_n.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_n.diminfo[2].strides, __pyx_t_21, __pyx_pybuffernd_n.diminfo[3].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_dS.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_dS.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_dS.diminfo[2].strides))));
15977  }
15978  }
15979 
15980  /* "subsurfaceTransportFunctions.pyx":730
15981  * for I in range(n.shape[3]):
15982  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15983  * flux[eN,ebN] = integral # <<<<<<<<<<<<<<
15984  *
15985  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df,
15986  */
15987  __pyx_t_25 = __pyx_v_eN;
15988  __pyx_t_26 = __pyx_v_ebN;
15989  __pyx_t_9 = -1;
15990  if (__pyx_t_25 < 0) {
15991  __pyx_t_25 += __pyx_pybuffernd_flux.diminfo[0].shape;
15992  if (unlikely(__pyx_t_25 < 0)) __pyx_t_9 = 0;
15993  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_flux.diminfo[0].shape)) __pyx_t_9 = 0;
15994  if (__pyx_t_26 < 0) {
15995  __pyx_t_26 += __pyx_pybuffernd_flux.diminfo[1].shape;
15996  if (unlikely(__pyx_t_26 < 0)) __pyx_t_9 = 1;
15997  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_flux.diminfo[1].shape)) __pyx_t_9 = 1;
15998  if (unlikely(__pyx_t_9 != -1)) {
15999  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16000  __PYX_ERR(0, 730, __pyx_L1_error)
16001  }
16002  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_flux.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_flux.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_flux.diminfo[1].strides) = __pyx_v_integral;
16003  }
16004  }
16005 
16006  /* "subsurfaceTransportFunctions.pyx":717
16007  * #ELLAM
16008  * ########################################################################
16009  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
16010  * numpy.ndarray[DTYPE_t,ndim=4] n,
16011  * numpy.ndarray[DTYPE_t,ndim=3] dS,
16012  */
16013 
16014  /* function exit code */
16015  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16016  goto __pyx_L0;
16017  __pyx_L1_error:;
16018  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16019  __Pyx_PyThreadState_declare
16020  __Pyx_PyThreadState_assign
16021  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16022  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
16023  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
16024  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
16025  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
16026  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16027  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
16028  __pyx_r = NULL;
16029  goto __pyx_L2;
16030  __pyx_L0:;
16031  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
16032  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
16033  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
16034  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
16035  __pyx_L2:;
16036  __Pyx_XGIVEREF(__pyx_r);
16037  __Pyx_RefNannyFinishContext();
16038  return __pyx_r;
16039 }
16040 
16041 /* "subsurfaceTransportFunctions.pyx":732
16042  * flux[eN,ebN] = integral
16043  *
16044  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
16045  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
16046  * numpy.ndarray[DTYPE_t,ndim=2] dm,
16047  */
16048 
16049 /* Python wrapper */
16050 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16051 static char __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
16052 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity = {"computeSimpleCharacteristicVelocityFromElementVelocity", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity};
16053 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16054  PyArrayObject *__pyx_v_df = 0;
16055  PyArrayObject *__pyx_v_characteristic_velocity = 0;
16056  PyArrayObject *__pyx_v_dm = 0;
16057  PyArrayObject *__pyx_v_dV = 0;
16058  PyObject *__pyx_r = 0;
16059  __Pyx_RefNannyDeclarations
16060  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity (wrapper)", 0);
16061  {
16062  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_characteristic_velocity,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
16063  PyObject* values[4] = {0,0,0,0};
16064  if (unlikely(__pyx_kwds)) {
16065  Py_ssize_t kw_args;
16066  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16067  switch (pos_args) {
16068  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16069  CYTHON_FALLTHROUGH;
16070  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16071  CYTHON_FALLTHROUGH;
16072  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16073  CYTHON_FALLTHROUGH;
16074  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16075  CYTHON_FALLTHROUGH;
16076  case 0: break;
16077  default: goto __pyx_L5_argtuple_error;
16078  }
16079  kw_args = PyDict_Size(__pyx_kwds);
16080  switch (pos_args) {
16081  case 0:
16082  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--;
16083  else goto __pyx_L5_argtuple_error;
16084  CYTHON_FALLTHROUGH;
16085  case 1:
16086  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_characteristic_velocity)) != 0)) kw_args--;
16087  else {
16088  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 1); __PYX_ERR(0, 732, __pyx_L3_error)
16089  }
16090  CYTHON_FALLTHROUGH;
16091  case 2:
16092  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
16093  else {
16094  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 2); __PYX_ERR(0, 732, __pyx_L3_error)
16095  }
16096  CYTHON_FALLTHROUGH;
16097  case 3:
16098  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
16099  else {
16100  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 3); __PYX_ERR(0, 732, __pyx_L3_error)
16101  }
16102  }
16103  if (unlikely(kw_args > 0)) {
16104  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromElementVelocity") < 0)) __PYX_ERR(0, 732, __pyx_L3_error)
16105  }
16106  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
16107  goto __pyx_L5_argtuple_error;
16108  } else {
16109  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16110  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16111  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16112  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16113  }
16114  __pyx_v_df = ((PyArrayObject *)values[0]);
16115  __pyx_v_characteristic_velocity = ((PyArrayObject *)values[1]);
16116  __pyx_v_dm = ((PyArrayObject *)values[2]);
16117  __pyx_v_dV = ((PyArrayObject *)values[3]);
16118  }
16119  goto __pyx_L4_argument_unpacking_done;
16120  __pyx_L5_argtuple_error:;
16121  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 732, __pyx_L3_error)
16122  __pyx_L3_error:;
16123  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
16124  __Pyx_RefNannyFinishContext();
16125  return NULL;
16126  __pyx_L4_argument_unpacking_done:;
16127  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df), __pyx_ptype_5numpy_ndarray, 1, "df", 0))) __PYX_ERR(0, 732, __pyx_L1_error)
16128  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity", 0))) __PYX_ERR(0, 733, __pyx_L1_error)
16129  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 734, __pyx_L1_error)
16130  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 735, __pyx_L1_error)
16131  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(__pyx_self, __pyx_v_df, __pyx_v_characteristic_velocity, __pyx_v_dm, __pyx_v_dV);
16132 
16133  /* function exit code */
16134  goto __pyx_L0;
16135  __pyx_L1_error:;
16136  __pyx_r = NULL;
16137  __pyx_L0:;
16138  __Pyx_RefNannyFinishContext();
16139  return __pyx_r;
16140 }
16141 
16142 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
16143  int __pyx_v_eN;
16144  int __pyx_v_k;
16145  int __pyx_v_I;
16146  double __pyx_v_omega_e;
16147  double __pyx_v_vol_e;
16148  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity;
16149  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity;
16150  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
16151  __Pyx_Buffer __pyx_pybuffer_dV;
16152  __Pyx_LocalBuf_ND __pyx_pybuffernd_df;
16153  __Pyx_Buffer __pyx_pybuffer_df;
16154  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
16155  __Pyx_Buffer __pyx_pybuffer_dm;
16156  PyObject *__pyx_r = NULL;
16157  __Pyx_RefNannyDeclarations
16158  npy_intp __pyx_t_1;
16159  npy_intp __pyx_t_2;
16160  int __pyx_t_3;
16161  npy_intp __pyx_t_4;
16162  npy_intp __pyx_t_5;
16163  int __pyx_t_6;
16164  Py_ssize_t __pyx_t_7;
16165  Py_ssize_t __pyx_t_8;
16166  int __pyx_t_9;
16167  Py_ssize_t __pyx_t_10;
16168  Py_ssize_t __pyx_t_11;
16169  Py_ssize_t __pyx_t_12;
16170  Py_ssize_t __pyx_t_13;
16171  npy_intp __pyx_t_14;
16172  npy_intp __pyx_t_15;
16173  Py_ssize_t __pyx_t_16;
16174  Py_ssize_t __pyx_t_17;
16175  Py_ssize_t __pyx_t_18;
16176  int __pyx_t_19;
16177  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_20;
16178  double __pyx_t_21;
16179  Py_ssize_t __pyx_t_22;
16180  Py_ssize_t __pyx_t_23;
16181  Py_ssize_t __pyx_t_24;
16182  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity", 0);
16183  __pyx_pybuffer_df.pybuffer.buf = NULL;
16184  __pyx_pybuffer_df.refcount = 0;
16185  __pyx_pybuffernd_df.data = NULL;
16186  __pyx_pybuffernd_df.rcbuffer = &__pyx_pybuffer_df;
16187  __pyx_pybuffer_characteristic_velocity.pybuffer.buf = NULL;
16188  __pyx_pybuffer_characteristic_velocity.refcount = 0;
16189  __pyx_pybuffernd_characteristic_velocity.data = NULL;
16190  __pyx_pybuffernd_characteristic_velocity.rcbuffer = &__pyx_pybuffer_characteristic_velocity;
16191  __pyx_pybuffer_dm.pybuffer.buf = NULL;
16192  __pyx_pybuffer_dm.refcount = 0;
16193  __pyx_pybuffernd_dm.data = NULL;
16194  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
16195  __pyx_pybuffer_dV.pybuffer.buf = NULL;
16196  __pyx_pybuffer_dV.refcount = 0;
16197  __pyx_pybuffernd_dV.data = NULL;
16198  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
16199  {
16200  __Pyx_BufFmt_StackElem __pyx_stack[1];
16201  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df.rcbuffer->pybuffer, (PyObject*)__pyx_v_df, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16202  }
16203  __pyx_pybuffernd_df.diminfo[0].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df.diminfo[0].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_df.diminfo[1].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_df.diminfo[1].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_df.diminfo[2].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_df.diminfo[2].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[2];
16204  {
16205  __Pyx_BufFmt_StackElem __pyx_stack[1];
16206  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16207  }
16208  __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[2];
16209  {
16210  __Pyx_BufFmt_StackElem __pyx_stack[1];
16211  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16212  }
16213  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
16214  {
16215  __Pyx_BufFmt_StackElem __pyx_stack[1];
16216  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16217  }
16218  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
16219 
16220  /* "subsurfaceTransportFunctions.pyx":743
16221  * cdef double omega_e, vol_e
16222  *
16223  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
16224  * omega_e = 0.0
16225  * vol_e = 0.0
16226  */
16227  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
16228  __pyx_t_2 = __pyx_t_1;
16229  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16230  __pyx_v_eN = __pyx_t_3;
16231 
16232  /* "subsurfaceTransportFunctions.pyx":744
16233  *
16234  * for eN in range(dm.shape[0]):
16235  * omega_e = 0.0 # <<<<<<<<<<<<<<
16236  * vol_e = 0.0
16237  * for k in range(dm.shape[1]):
16238  */
16239  __pyx_v_omega_e = 0.0;
16240 
16241  /* "subsurfaceTransportFunctions.pyx":745
16242  * for eN in range(dm.shape[0]):
16243  * omega_e = 0.0
16244  * vol_e = 0.0 # <<<<<<<<<<<<<<
16245  * for k in range(dm.shape[1]):
16246  * vol_e += dV[eN,k]
16247  */
16248  __pyx_v_vol_e = 0.0;
16249 
16250  /* "subsurfaceTransportFunctions.pyx":746
16251  * omega_e = 0.0
16252  * vol_e = 0.0
16253  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
16254  * vol_e += dV[eN,k]
16255  * omega_e += dV[eN,k]*dm[eN,k]
16256  */
16257  __pyx_t_4 = (__pyx_v_dm->dimensions[1]);
16258  __pyx_t_5 = __pyx_t_4;
16259  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16260  __pyx_v_k = __pyx_t_6;
16261 
16262  /* "subsurfaceTransportFunctions.pyx":747
16263  * vol_e = 0.0
16264  * for k in range(dm.shape[1]):
16265  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
16266  * omega_e += dV[eN,k]*dm[eN,k]
16267  * for k in range(df.shape[1]):
16268  */
16269  __pyx_t_7 = __pyx_v_eN;
16270  __pyx_t_8 = __pyx_v_k;
16271  __pyx_t_9 = -1;
16272  if (__pyx_t_7 < 0) {
16273  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
16274  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
16275  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16276  if (__pyx_t_8 < 0) {
16277  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
16278  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
16279  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16280  if (unlikely(__pyx_t_9 != -1)) {
16281  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16282  __PYX_ERR(0, 747, __pyx_L1_error)
16283  }
16284  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
16285 
16286  /* "subsurfaceTransportFunctions.pyx":748
16287  * for k in range(dm.shape[1]):
16288  * vol_e += dV[eN,k]
16289  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
16290  * for k in range(df.shape[1]):
16291  * for I in range(df.shape[2]):
16292  */
16293  __pyx_t_10 = __pyx_v_eN;
16294  __pyx_t_11 = __pyx_v_k;
16295  __pyx_t_9 = -1;
16296  if (__pyx_t_10 < 0) {
16297  __pyx_t_10 += __pyx_pybuffernd_dV.diminfo[0].shape;
16298  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16299  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16300  if (__pyx_t_11 < 0) {
16301  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[1].shape;
16302  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
16303  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16304  if (unlikely(__pyx_t_9 != -1)) {
16305  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16306  __PYX_ERR(0, 748, __pyx_L1_error)
16307  }
16308  __pyx_t_12 = __pyx_v_eN;
16309  __pyx_t_13 = __pyx_v_k;
16310  __pyx_t_9 = -1;
16311  if (__pyx_t_12 < 0) {
16312  __pyx_t_12 += __pyx_pybuffernd_dm.diminfo[0].shape;
16313  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
16314  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_9 = 0;
16315  if (__pyx_t_13 < 0) {
16316  __pyx_t_13 += __pyx_pybuffernd_dm.diminfo[1].shape;
16317  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
16318  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_9 = 1;
16319  if (unlikely(__pyx_t_9 != -1)) {
16320  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16321  __PYX_ERR(0, 748, __pyx_L1_error)
16322  }
16323  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_dm.diminfo[1].strides))));
16324  }
16325 
16326  /* "subsurfaceTransportFunctions.pyx":749
16327  * vol_e += dV[eN,k]
16328  * omega_e += dV[eN,k]*dm[eN,k]
16329  * for k in range(df.shape[1]): # <<<<<<<<<<<<<<
16330  * for I in range(df.shape[2]):
16331  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16332  */
16333  __pyx_t_4 = (__pyx_v_df->dimensions[1]);
16334  __pyx_t_5 = __pyx_t_4;
16335  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16336  __pyx_v_k = __pyx_t_6;
16337 
16338  /* "subsurfaceTransportFunctions.pyx":750
16339  * omega_e += dV[eN,k]*dm[eN,k]
16340  * for k in range(df.shape[1]):
16341  * for I in range(df.shape[2]): # <<<<<<<<<<<<<<
16342  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16343  *
16344  */
16345  __pyx_t_14 = (__pyx_v_df->dimensions[2]);
16346  __pyx_t_15 = __pyx_t_14;
16347  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_15; __pyx_t_9+=1) {
16348  __pyx_v_I = __pyx_t_9;
16349 
16350  /* "subsurfaceTransportFunctions.pyx":751
16351  * for k in range(df.shape[1]):
16352  * for I in range(df.shape[2]):
16353  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
16354  *
16355  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs,
16356  */
16357  __pyx_t_16 = __pyx_v_eN;
16358  __pyx_t_17 = __pyx_v_k;
16359  __pyx_t_18 = __pyx_v_I;
16360  __pyx_t_19 = -1;
16361  if (__pyx_t_16 < 0) {
16362  __pyx_t_16 += __pyx_pybuffernd_df.diminfo[0].shape;
16363  if (unlikely(__pyx_t_16 < 0)) __pyx_t_19 = 0;
16364  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_df.diminfo[0].shape)) __pyx_t_19 = 0;
16365  if (__pyx_t_17 < 0) {
16366  __pyx_t_17 += __pyx_pybuffernd_df.diminfo[1].shape;
16367  if (unlikely(__pyx_t_17 < 0)) __pyx_t_19 = 1;
16368  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_df.diminfo[1].shape)) __pyx_t_19 = 1;
16369  if (__pyx_t_18 < 0) {
16370  __pyx_t_18 += __pyx_pybuffernd_df.diminfo[2].shape;
16371  if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 2;
16372  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_df.diminfo[2].shape)) __pyx_t_19 = 2;
16373  if (unlikely(__pyx_t_19 != -1)) {
16374  __Pyx_RaiseBufferIndexError(__pyx_t_19);
16375  __PYX_ERR(0, 751, __pyx_L1_error)
16376  }
16377  __pyx_t_20 = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_df.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_df.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_df.diminfo[2].strides)) * __pyx_v_vol_e);
16378  __pyx_t_21 = (__pyx_v_omega_e + 1.0e-12);
16379  if (unlikely(__pyx_t_21 == 0)) {
16380  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16381  __PYX_ERR(0, 751, __pyx_L1_error)
16382  }
16383  __pyx_t_22 = __pyx_v_eN;
16384  __pyx_t_23 = __pyx_v_k;
16385  __pyx_t_24 = __pyx_v_I;
16386  __pyx_t_19 = -1;
16387  if (__pyx_t_22 < 0) {
16388  __pyx_t_22 += __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape;
16389  if (unlikely(__pyx_t_22 < 0)) __pyx_t_19 = 0;
16390  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape)) __pyx_t_19 = 0;
16391  if (__pyx_t_23 < 0) {
16392  __pyx_t_23 += __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape;
16393  if (unlikely(__pyx_t_23 < 0)) __pyx_t_19 = 1;
16394  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape)) __pyx_t_19 = 1;
16395  if (__pyx_t_24 < 0) {
16396  __pyx_t_24 += __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape;
16397  if (unlikely(__pyx_t_24 < 0)) __pyx_t_19 = 2;
16398  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape)) __pyx_t_19 = 2;
16399  if (unlikely(__pyx_t_19 != -1)) {
16400  __Pyx_RaiseBufferIndexError(__pyx_t_19);
16401  __PYX_ERR(0, 751, __pyx_L1_error)
16402  }
16403  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides) = (__pyx_t_20 / __pyx_t_21);
16404  }
16405  }
16406  }
16407 
16408  /* "subsurfaceTransportFunctions.pyx":732
16409  * flux[eN,ebN] = integral
16410  *
16411  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
16412  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
16413  * numpy.ndarray[DTYPE_t,ndim=2] dm,
16414  */
16415 
16416  /* function exit code */
16417  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16418  goto __pyx_L0;
16419  __pyx_L1_error:;
16420  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16421  __Pyx_PyThreadState_declare
16422  __Pyx_PyThreadState_assign
16423  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16424  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
16425  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16426  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
16427  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16428  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16429  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
16430  __pyx_r = NULL;
16431  goto __pyx_L2;
16432  __pyx_L0:;
16433  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
16434  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16435  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
16436  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16437  __pyx_L2:;
16438  __Pyx_XGIVEREF(__pyx_r);
16439  __Pyx_RefNannyFinishContext();
16440  return __pyx_r;
16441 }
16442 
16443 /* "subsurfaceTransportFunctions.pyx":753
16444  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16445  *
16446  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
16447  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
16448  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
16449  */
16450 
16451 /* Python wrapper */
16452 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16453 static char __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
16454 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs = {"computeSimpleCharacteristicVelocityFromVelocityDOFs", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs};
16455 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16456  PyArrayObject *__pyx_v_df_dofs = 0;
16457  PyArrayObject *__pyx_v_characteristic_velocity_dofs = 0;
16458  PyArrayObject *__pyx_v_l2g = 0;
16459  PyArrayObject *__pyx_v_dm = 0;
16460  PyArrayObject *__pyx_v_dV = 0;
16461  PyObject *__pyx_r = 0;
16462  __Pyx_RefNannyDeclarations
16463  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs (wrapper)", 0);
16464  {
16465  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df_dofs,&__pyx_n_s_characteristic_velocity_dofs,&__pyx_n_s_l2g,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
16466  PyObject* values[5] = {0,0,0,0,0};
16467  if (unlikely(__pyx_kwds)) {
16468  Py_ssize_t kw_args;
16469  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16470  switch (pos_args) {
16471  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16472  CYTHON_FALLTHROUGH;
16473  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16474  CYTHON_FALLTHROUGH;
16475  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16476  CYTHON_FALLTHROUGH;
16477  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16478  CYTHON_FALLTHROUGH;
16479  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16480  CYTHON_FALLTHROUGH;
16481  case 0: break;
16482  default: goto __pyx_L5_argtuple_error;
16483  }
16484  kw_args = PyDict_Size(__pyx_kwds);
16485  switch (pos_args) {
16486  case 0:
16487  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df_dofs)) != 0)) kw_args--;
16488  else goto __pyx_L5_argtuple_error;
16489  CYTHON_FALLTHROUGH;
16490  case 1:
16491  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_characteristic_velocity_dofs)) != 0)) kw_args--;
16492  else {
16493  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 1); __PYX_ERR(0, 753, __pyx_L3_error)
16494  }
16495  CYTHON_FALLTHROUGH;
16496  case 2:
16497  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l2g)) != 0)) kw_args--;
16498  else {
16499  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 2); __PYX_ERR(0, 753, __pyx_L3_error)
16500  }
16501  CYTHON_FALLTHROUGH;
16502  case 3:
16503  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
16504  else {
16505  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 3); __PYX_ERR(0, 753, __pyx_L3_error)
16506  }
16507  CYTHON_FALLTHROUGH;
16508  case 4:
16509  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
16510  else {
16511  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 4); __PYX_ERR(0, 753, __pyx_L3_error)
16512  }
16513  }
16514  if (unlikely(kw_args > 0)) {
16515  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromVelocityDOFs") < 0)) __PYX_ERR(0, 753, __pyx_L3_error)
16516  }
16517  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
16518  goto __pyx_L5_argtuple_error;
16519  } else {
16520  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16521  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16522  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16523  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16524  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16525  }
16526  __pyx_v_df_dofs = ((PyArrayObject *)values[0]);
16527  __pyx_v_characteristic_velocity_dofs = ((PyArrayObject *)values[1]);
16528  __pyx_v_l2g = ((PyArrayObject *)values[2]);
16529  __pyx_v_dm = ((PyArrayObject *)values[3]);
16530  __pyx_v_dV = ((PyArrayObject *)values[4]);
16531  }
16532  goto __pyx_L4_argument_unpacking_done;
16533  __pyx_L5_argtuple_error:;
16534  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 753, __pyx_L3_error)
16535  __pyx_L3_error:;
16536  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16537  __Pyx_RefNannyFinishContext();
16538  return NULL;
16539  __pyx_L4_argument_unpacking_done:;
16540  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df_dofs), __pyx_ptype_5numpy_ndarray, 1, "df_dofs", 0))) __PYX_ERR(0, 753, __pyx_L1_error)
16541  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity_dofs), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity_dofs", 0))) __PYX_ERR(0, 754, __pyx_L1_error)
16542  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_l2g), __pyx_ptype_5numpy_ndarray, 1, "l2g", 0))) __PYX_ERR(0, 755, __pyx_L1_error)
16543  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 756, __pyx_L1_error)
16544  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 757, __pyx_L1_error)
16545  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(__pyx_self, __pyx_v_df_dofs, __pyx_v_characteristic_velocity_dofs, __pyx_v_l2g, __pyx_v_dm, __pyx_v_dV);
16546 
16547  /* function exit code */
16548  goto __pyx_L0;
16549  __pyx_L1_error:;
16550  __pyx_r = NULL;
16551  __pyx_L0:;
16552  __Pyx_RefNannyFinishContext();
16553  return __pyx_r;
16554 }
16555 
16556 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
16557  int __pyx_v_eN;
16558  int __pyx_v_k;
16559  int __pyx_v_j;
16560  int __pyx_v_J;
16561  double __pyx_v_omega_e;
16562  double __pyx_v_vol_e;
16563  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity_dofs;
16564  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity_dofs;
16565  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
16566  __Pyx_Buffer __pyx_pybuffer_dV;
16567  __Pyx_LocalBuf_ND __pyx_pybuffernd_df_dofs;
16568  __Pyx_Buffer __pyx_pybuffer_df_dofs;
16569  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
16570  __Pyx_Buffer __pyx_pybuffer_dm;
16571  __Pyx_LocalBuf_ND __pyx_pybuffernd_l2g;
16572  __Pyx_Buffer __pyx_pybuffer_l2g;
16573  PyObject *__pyx_r = NULL;
16574  __Pyx_RefNannyDeclarations
16575  npy_intp __pyx_t_1;
16576  npy_intp __pyx_t_2;
16577  int __pyx_t_3;
16578  npy_intp __pyx_t_4;
16579  npy_intp __pyx_t_5;
16580  int __pyx_t_6;
16581  Py_ssize_t __pyx_t_7;
16582  Py_ssize_t __pyx_t_8;
16583  int __pyx_t_9;
16584  Py_ssize_t __pyx_t_10;
16585  Py_ssize_t __pyx_t_11;
16586  Py_ssize_t __pyx_t_12;
16587  Py_ssize_t __pyx_t_13;
16588  Py_ssize_t __pyx_t_14;
16589  Py_ssize_t __pyx_t_15;
16590  Py_ssize_t __pyx_t_16;
16591  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_17;
16592  double __pyx_t_18;
16593  Py_ssize_t __pyx_t_19;
16594  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs", 0);
16595  __pyx_pybuffer_df_dofs.pybuffer.buf = NULL;
16596  __pyx_pybuffer_df_dofs.refcount = 0;
16597  __pyx_pybuffernd_df_dofs.data = NULL;
16598  __pyx_pybuffernd_df_dofs.rcbuffer = &__pyx_pybuffer_df_dofs;
16599  __pyx_pybuffer_characteristic_velocity_dofs.pybuffer.buf = NULL;
16600  __pyx_pybuffer_characteristic_velocity_dofs.refcount = 0;
16601  __pyx_pybuffernd_characteristic_velocity_dofs.data = NULL;
16602  __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer = &__pyx_pybuffer_characteristic_velocity_dofs;
16603  __pyx_pybuffer_l2g.pybuffer.buf = NULL;
16604  __pyx_pybuffer_l2g.refcount = 0;
16605  __pyx_pybuffernd_l2g.data = NULL;
16606  __pyx_pybuffernd_l2g.rcbuffer = &__pyx_pybuffer_l2g;
16607  __pyx_pybuffer_dm.pybuffer.buf = NULL;
16608  __pyx_pybuffer_dm.refcount = 0;
16609  __pyx_pybuffernd_dm.data = NULL;
16610  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
16611  __pyx_pybuffer_dV.pybuffer.buf = NULL;
16612  __pyx_pybuffer_dV.refcount = 0;
16613  __pyx_pybuffernd_dV.data = NULL;
16614  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
16615  {
16616  __Pyx_BufFmt_StackElem __pyx_stack[1];
16617  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_df_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16618  }
16619  __pyx_pybuffernd_df_dofs.diminfo[0].strides = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df_dofs.diminfo[0].shape = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.shape[0];
16620  {
16621  __Pyx_BufFmt_StackElem __pyx_stack[1];
16622  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16623  }
16624  __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.shape[0];
16625  {
16626  __Pyx_BufFmt_StackElem __pyx_stack[1];
16627  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16628  }
16629  __pyx_pybuffernd_l2g.diminfo[0].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_l2g.diminfo[0].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_l2g.diminfo[1].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_l2g.diminfo[1].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[1];
16630  {
16631  __Pyx_BufFmt_StackElem __pyx_stack[1];
16632  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16633  }
16634  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
16635  {
16636  __Pyx_BufFmt_StackElem __pyx_stack[1];
16637  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16638  }
16639  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
16640 
16641  /* "subsurfaceTransportFunctions.pyx":765
16642  * cdef double omega_e, vol_e
16643  *
16644  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
16645  * omega_e = 0.0
16646  * vol_e = 0.0
16647  */
16648  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
16649  __pyx_t_2 = __pyx_t_1;
16650  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16651  __pyx_v_eN = __pyx_t_3;
16652 
16653  /* "subsurfaceTransportFunctions.pyx":766
16654  *
16655  * for eN in range(dm.shape[0]):
16656  * omega_e = 0.0 # <<<<<<<<<<<<<<
16657  * vol_e = 0.0
16658  * for k in range(dm.shape[1]):
16659  */
16660  __pyx_v_omega_e = 0.0;
16661 
16662  /* "subsurfaceTransportFunctions.pyx":767
16663  * for eN in range(dm.shape[0]):
16664  * omega_e = 0.0
16665  * vol_e = 0.0 # <<<<<<<<<<<<<<
16666  * for k in range(dm.shape[1]):
16667  * vol_e += dV[eN,k]
16668  */
16669  __pyx_v_vol_e = 0.0;
16670 
16671  /* "subsurfaceTransportFunctions.pyx":768
16672  * omega_e = 0.0
16673  * vol_e = 0.0
16674  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
16675  * vol_e += dV[eN,k]
16676  * omega_e += dV[eN,k]*dm[eN,k]
16677  */
16678  __pyx_t_4 = (__pyx_v_dm->dimensions[1]);
16679  __pyx_t_5 = __pyx_t_4;
16680  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16681  __pyx_v_k = __pyx_t_6;
16682 
16683  /* "subsurfaceTransportFunctions.pyx":769
16684  * vol_e = 0.0
16685  * for k in range(dm.shape[1]):
16686  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
16687  * omega_e += dV[eN,k]*dm[eN,k]
16688  * for j in range(l2g.shape[1]):
16689  */
16690  __pyx_t_7 = __pyx_v_eN;
16691  __pyx_t_8 = __pyx_v_k;
16692  __pyx_t_9 = -1;
16693  if (__pyx_t_7 < 0) {
16694  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
16695  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
16696  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16697  if (__pyx_t_8 < 0) {
16698  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
16699  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
16700  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16701  if (unlikely(__pyx_t_9 != -1)) {
16702  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16703  __PYX_ERR(0, 769, __pyx_L1_error)
16704  }
16705  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
16706 
16707  /* "subsurfaceTransportFunctions.pyx":770
16708  * for k in range(dm.shape[1]):
16709  * vol_e += dV[eN,k]
16710  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
16711  * for j in range(l2g.shape[1]):
16712  * J = l2g[eN,j]
16713  */
16714  __pyx_t_10 = __pyx_v_eN;
16715  __pyx_t_11 = __pyx_v_k;
16716  __pyx_t_9 = -1;
16717  if (__pyx_t_10 < 0) {
16718  __pyx_t_10 += __pyx_pybuffernd_dV.diminfo[0].shape;
16719  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16720  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16721  if (__pyx_t_11 < 0) {
16722  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[1].shape;
16723  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
16724  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16725  if (unlikely(__pyx_t_9 != -1)) {
16726  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16727  __PYX_ERR(0, 770, __pyx_L1_error)
16728  }
16729  __pyx_t_12 = __pyx_v_eN;
16730  __pyx_t_13 = __pyx_v_k;
16731  __pyx_t_9 = -1;
16732  if (__pyx_t_12 < 0) {
16733  __pyx_t_12 += __pyx_pybuffernd_dm.diminfo[0].shape;
16734  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0;
16735  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_9 = 0;
16736  if (__pyx_t_13 < 0) {
16737  __pyx_t_13 += __pyx_pybuffernd_dm.diminfo[1].shape;
16738  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1;
16739  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_9 = 1;
16740  if (unlikely(__pyx_t_9 != -1)) {
16741  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16742  __PYX_ERR(0, 770, __pyx_L1_error)
16743  }
16744  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_dm.diminfo[1].strides))));
16745  }
16746 
16747  /* "subsurfaceTransportFunctions.pyx":771
16748  * vol_e += dV[eN,k]
16749  * omega_e += dV[eN,k]*dm[eN,k]
16750  * for j in range(l2g.shape[1]): # <<<<<<<<<<<<<<
16751  * J = l2g[eN,j]
16752  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16753  */
16754  __pyx_t_4 = (__pyx_v_l2g->dimensions[1]);
16755  __pyx_t_5 = __pyx_t_4;
16756  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16757  __pyx_v_j = __pyx_t_6;
16758 
16759  /* "subsurfaceTransportFunctions.pyx":772
16760  * omega_e += dV[eN,k]*dm[eN,k]
16761  * for j in range(l2g.shape[1]):
16762  * J = l2g[eN,j] # <<<<<<<<<<<<<<
16763  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16764  *
16765  */
16766  __pyx_t_14 = __pyx_v_eN;
16767  __pyx_t_15 = __pyx_v_j;
16768  __pyx_t_9 = -1;
16769  if (__pyx_t_14 < 0) {
16770  __pyx_t_14 += __pyx_pybuffernd_l2g.diminfo[0].shape;
16771  if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0;
16772  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_l2g.diminfo[0].shape)) __pyx_t_9 = 0;
16773  if (__pyx_t_15 < 0) {
16774  __pyx_t_15 += __pyx_pybuffernd_l2g.diminfo[1].shape;
16775  if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 1;
16776  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_l2g.diminfo[1].shape)) __pyx_t_9 = 1;
16777  if (unlikely(__pyx_t_9 != -1)) {
16778  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16779  __PYX_ERR(0, 772, __pyx_L1_error)
16780  }
16781  __pyx_v_J = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_l2g.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_l2g.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_l2g.diminfo[1].strides));
16782 
16783  /* "subsurfaceTransportFunctions.pyx":773
16784  * for j in range(l2g.shape[1]):
16785  * J = l2g[eN,j]
16786  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
16787  *
16788  * #problem specific velocity evaluation
16789  */
16790  __pyx_t_16 = __pyx_v_J;
16791  __pyx_t_9 = -1;
16792  if (__pyx_t_16 < 0) {
16793  __pyx_t_16 += __pyx_pybuffernd_df_dofs.diminfo[0].shape;
16794  if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
16795  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_df_dofs.diminfo[0].shape)) __pyx_t_9 = 0;
16796  if (unlikely(__pyx_t_9 != -1)) {
16797  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16798  __PYX_ERR(0, 773, __pyx_L1_error)
16799  }
16800  __pyx_t_17 = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_df_dofs.diminfo[0].strides)) * __pyx_v_vol_e);
16801  __pyx_t_18 = (__pyx_v_omega_e + 1.0e-12);
16802  if (unlikely(__pyx_t_18 == 0)) {
16803  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16804  __PYX_ERR(0, 773, __pyx_L1_error)
16805  }
16806  __pyx_t_19 = __pyx_v_J;
16807  __pyx_t_9 = -1;
16808  if (__pyx_t_19 < 0) {
16809  __pyx_t_19 += __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape;
16810  if (unlikely(__pyx_t_19 < 0)) __pyx_t_9 = 0;
16811  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape)) __pyx_t_9 = 0;
16812  if (unlikely(__pyx_t_9 != -1)) {
16813  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16814  __PYX_ERR(0, 773, __pyx_L1_error)
16815  }
16816  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides) = (__pyx_t_17 / __pyx_t_18);
16817  }
16818  }
16819 
16820  /* "subsurfaceTransportFunctions.pyx":753
16821  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16822  *
16823  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
16824  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
16825  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
16826  */
16827 
16828  /* function exit code */
16829  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16830  goto __pyx_L0;
16831  __pyx_L1_error:;
16832  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16833  __Pyx_PyThreadState_declare
16834  __Pyx_PyThreadState_assign
16835  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16836  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16837  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16838  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16839  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16840  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16841  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16842  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16843  __pyx_r = NULL;
16844  goto __pyx_L2;
16845  __pyx_L0:;
16846  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16847  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16848  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16849  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16850  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16851  __pyx_L2:;
16852  __Pyx_XGIVEREF(__pyx_r);
16853  __Pyx_RefNannyFinishContext();
16854  return __pyx_r;
16855 }
16856 
16857 /* "subsurfaceTransportFunctions.pyx":776
16858  *
16859  * #problem specific velocity evaluation
16860  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
16861  * double t,
16862  * double tForReversal,
16863  */
16864 
16865 /* Python wrapper */
16866 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16867 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3 = {"rotatingGaussianElementVelocityEval3", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
16868 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16869  int __pyx_v_transient;
16870  double __pyx_v_t;
16871  double __pyx_v_tForReversal;
16872  double __pyx_v_clock;
16873  double __pyx_v_xc;
16874  double __pyx_v_yc;
16875  PyArrayObject *__pyx_v_x = 0;
16876  PyArrayObject *__pyx_v_v = 0;
16877  double __pyx_v_zvelocity;
16878  PyObject *__pyx_r = 0;
16879  __Pyx_RefNannyDeclarations
16880  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3 (wrapper)", 0);
16881  {
16882  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
16883  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
16884  if (unlikely(__pyx_kwds)) {
16885  Py_ssize_t kw_args;
16886  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16887  switch (pos_args) {
16888  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16889  CYTHON_FALLTHROUGH;
16890  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16891  CYTHON_FALLTHROUGH;
16892  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16893  CYTHON_FALLTHROUGH;
16894  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16895  CYTHON_FALLTHROUGH;
16896  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16897  CYTHON_FALLTHROUGH;
16898  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16899  CYTHON_FALLTHROUGH;
16900  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16901  CYTHON_FALLTHROUGH;
16902  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16903  CYTHON_FALLTHROUGH;
16904  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16905  CYTHON_FALLTHROUGH;
16906  case 0: break;
16907  default: goto __pyx_L5_argtuple_error;
16908  }
16909  kw_args = PyDict_Size(__pyx_kwds);
16910  switch (pos_args) {
16911  case 0:
16912  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
16913  else goto __pyx_L5_argtuple_error;
16914  CYTHON_FALLTHROUGH;
16915  case 1:
16916  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
16917  else {
16918  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 1); __PYX_ERR(0, 776, __pyx_L3_error)
16919  }
16920  CYTHON_FALLTHROUGH;
16921  case 2:
16922  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
16923  else {
16924  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 2); __PYX_ERR(0, 776, __pyx_L3_error)
16925  }
16926  CYTHON_FALLTHROUGH;
16927  case 3:
16928  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
16929  else {
16930  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 3); __PYX_ERR(0, 776, __pyx_L3_error)
16931  }
16932  CYTHON_FALLTHROUGH;
16933  case 4:
16934  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
16935  else {
16936  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 4); __PYX_ERR(0, 776, __pyx_L3_error)
16937  }
16938  CYTHON_FALLTHROUGH;
16939  case 5:
16940  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
16941  else {
16942  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 5); __PYX_ERR(0, 776, __pyx_L3_error)
16943  }
16944  CYTHON_FALLTHROUGH;
16945  case 6:
16946  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
16947  else {
16948  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 6); __PYX_ERR(0, 776, __pyx_L3_error)
16949  }
16950  CYTHON_FALLTHROUGH;
16951  case 7:
16952  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
16953  else {
16954  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 7); __PYX_ERR(0, 776, __pyx_L3_error)
16955  }
16956  CYTHON_FALLTHROUGH;
16957  case 8:
16958  if (kw_args > 0) {
16959  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zvelocity);
16960  if (value) { values[8] = value; kw_args--; }
16961  }
16962  }
16963  if (unlikely(kw_args > 0)) {
16964  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval3") < 0)) __PYX_ERR(0, 776, __pyx_L3_error)
16965  }
16966  } else {
16967  switch (PyTuple_GET_SIZE(__pyx_args)) {
16968  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16969  CYTHON_FALLTHROUGH;
16970  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16971  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16972  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16973  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16974  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16975  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16976  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16977  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16978  break;
16979  default: goto __pyx_L5_argtuple_error;
16980  }
16981  }
16982  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L3_error)
16983  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L3_error)
16984  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L3_error)
16985  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 779, __pyx_L3_error)
16986  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16987  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16988  __pyx_v_x = ((PyArrayObject *)values[6]);
16989  __pyx_v_v = ((PyArrayObject *)values[7]);
16990  if (values[8]) {
16991  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error)
16992  } else {
16993  __pyx_v_zvelocity = ((double)0.0);
16994  }
16995  }
16996  goto __pyx_L4_argument_unpacking_done;
16997  __pyx_L5_argtuple_error:;
16998  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 776, __pyx_L3_error)
16999  __pyx_L3_error:;
17000  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
17001  __Pyx_RefNannyFinishContext();
17002  return NULL;
17003  __pyx_L4_argument_unpacking_done:;
17004  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 781, __pyx_L1_error)
17005  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 782, __pyx_L1_error)
17006  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
17007 
17008  /* function exit code */
17009  goto __pyx_L0;
17010  __pyx_L1_error:;
17011  __pyx_r = NULL;
17012  __pyx_L0:;
17013  __Pyx_RefNannyFinishContext();
17014  return __pyx_r;
17015 }
17016 
17017 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
17018  int __pyx_v_eN;
17019  int __pyx_v_k;
17020  double __pyx_v_pi;
17021  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
17022  __Pyx_Buffer __pyx_pybuffer_v;
17023  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
17024  __Pyx_Buffer __pyx_pybuffer_x;
17025  PyObject *__pyx_r = NULL;
17026  __Pyx_RefNannyDeclarations
17027  int __pyx_t_1;
17028  npy_intp __pyx_t_2;
17029  npy_intp __pyx_t_3;
17030  int __pyx_t_4;
17031  npy_intp __pyx_t_5;
17032  npy_intp __pyx_t_6;
17033  int __pyx_t_7;
17034  Py_ssize_t __pyx_t_8;
17035  Py_ssize_t __pyx_t_9;
17036  Py_ssize_t __pyx_t_10;
17037  int __pyx_t_11;
17038  Py_ssize_t __pyx_t_12;
17039  Py_ssize_t __pyx_t_13;
17040  Py_ssize_t __pyx_t_14;
17041  Py_ssize_t __pyx_t_15;
17042  Py_ssize_t __pyx_t_16;
17043  Py_ssize_t __pyx_t_17;
17044  Py_ssize_t __pyx_t_18;
17045  Py_ssize_t __pyx_t_19;
17046  Py_ssize_t __pyx_t_20;
17047  Py_ssize_t __pyx_t_21;
17048  Py_ssize_t __pyx_t_22;
17049  Py_ssize_t __pyx_t_23;
17050  PyObject *__pyx_t_24 = NULL;
17051  PyObject *__pyx_t_25 = NULL;
17052  PyObject *__pyx_t_26 = NULL;
17053  double __pyx_t_27;
17054  double __pyx_t_28;
17055  PyObject *__pyx_t_29 = NULL;
17056  Py_ssize_t __pyx_t_30;
17057  Py_ssize_t __pyx_t_31;
17058  Py_ssize_t __pyx_t_32;
17059  Py_ssize_t __pyx_t_33;
17060  Py_ssize_t __pyx_t_34;
17061  Py_ssize_t __pyx_t_35;
17062  Py_ssize_t __pyx_t_36;
17063  Py_ssize_t __pyx_t_37;
17064  Py_ssize_t __pyx_t_38;
17065  Py_ssize_t __pyx_t_39;
17066  Py_ssize_t __pyx_t_40;
17067  Py_ssize_t __pyx_t_41;
17068  Py_ssize_t __pyx_t_42;
17069  Py_ssize_t __pyx_t_43;
17070  Py_ssize_t __pyx_t_44;
17071  Py_ssize_t __pyx_t_45;
17072  Py_ssize_t __pyx_t_46;
17073  Py_ssize_t __pyx_t_47;
17074  Py_ssize_t __pyx_t_48;
17075  Py_ssize_t __pyx_t_49;
17076  Py_ssize_t __pyx_t_50;
17077  Py_ssize_t __pyx_t_51;
17078  Py_ssize_t __pyx_t_52;
17079  Py_ssize_t __pyx_t_53;
17080  Py_ssize_t __pyx_t_54;
17081  Py_ssize_t __pyx_t_55;
17082  Py_ssize_t __pyx_t_56;
17083  Py_ssize_t __pyx_t_57;
17084  Py_ssize_t __pyx_t_58;
17085  Py_ssize_t __pyx_t_59;
17086  Py_ssize_t __pyx_t_60;
17087  Py_ssize_t __pyx_t_61;
17088  Py_ssize_t __pyx_t_62;
17089  Py_ssize_t __pyx_t_63;
17090  Py_ssize_t __pyx_t_64;
17091  Py_ssize_t __pyx_t_65;
17092  Py_ssize_t __pyx_t_66;
17093  Py_ssize_t __pyx_t_67;
17094  Py_ssize_t __pyx_t_68;
17095  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3", 0);
17096  __pyx_pybuffer_x.pybuffer.buf = NULL;
17097  __pyx_pybuffer_x.refcount = 0;
17098  __pyx_pybuffernd_x.data = NULL;
17099  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
17100  __pyx_pybuffer_v.pybuffer.buf = NULL;
17101  __pyx_pybuffer_v.refcount = 0;
17102  __pyx_pybuffernd_v.data = NULL;
17103  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
17104  {
17105  __Pyx_BufFmt_StackElem __pyx_stack[1];
17106  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 776, __pyx_L1_error)
17107  }
17108  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
17109  {
17110  __Pyx_BufFmt_StackElem __pyx_stack[1];
17111  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 776, __pyx_L1_error)
17112  }
17113  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
17114 
17115  /* "subsurfaceTransportFunctions.pyx":786
17116  * cdef int eN,k
17117  * cdef double pi
17118  * pi = M_PI # <<<<<<<<<<<<<<
17119  * if v.shape[2] == 3:
17120  * if transient == 1:
17121  */
17122  __pyx_v_pi = M_PI;
17123 
17124  /* "subsurfaceTransportFunctions.pyx":787
17125  * cdef double pi
17126  * pi = M_PI
17127  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
17128  * if transient == 1:
17129  * for eN in range(x.shape[0]):
17130  */
17131  __pyx_t_1 = (((__pyx_v_v->dimensions[2]) == 3) != 0);
17132  if (__pyx_t_1) {
17133 
17134  /* "subsurfaceTransportFunctions.pyx":788
17135  * pi = M_PI
17136  * if v.shape[2] == 3:
17137  * if transient == 1: # <<<<<<<<<<<<<<
17138  * for eN in range(x.shape[0]):
17139  * for k in range(x.shape[1]):
17140  */
17141  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17142  if (__pyx_t_1) {
17143 
17144  /* "subsurfaceTransportFunctions.pyx":789
17145  * if v.shape[2] == 3:
17146  * if transient == 1:
17147  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17148  * for k in range(x.shape[1]):
17149  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17150  */
17151  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17152  __pyx_t_3 = __pyx_t_2;
17153  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17154  __pyx_v_eN = __pyx_t_4;
17155 
17156  /* "subsurfaceTransportFunctions.pyx":790
17157  * if transient == 1:
17158  * for eN in range(x.shape[0]):
17159  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17160  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17161  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17162  */
17163  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17164  __pyx_t_6 = __pyx_t_5;
17165  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17166  __pyx_v_k = __pyx_t_7;
17167 
17168  /* "subsurfaceTransportFunctions.pyx":791
17169  * for eN in range(x.shape[0]):
17170  * for k in range(x.shape[1]):
17171  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17172  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17173  * v[eN,k,2]=zvelocity
17174  */
17175  __pyx_t_8 = __pyx_v_eN;
17176  __pyx_t_9 = __pyx_v_k;
17177  __pyx_t_10 = 1;
17178  __pyx_t_11 = -1;
17179  if (__pyx_t_8 < 0) {
17180  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17181  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17182  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17183  if (__pyx_t_9 < 0) {
17184  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17185  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17186  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17187  if (__pyx_t_10 < 0) {
17188  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17189  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17190  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17191  if (unlikely(__pyx_t_11 != -1)) {
17192  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17193  __PYX_ERR(0, 791, __pyx_L1_error)
17194  }
17195  __pyx_t_12 = __pyx_v_eN;
17196  __pyx_t_13 = __pyx_v_k;
17197  __pyx_t_14 = 0;
17198  __pyx_t_11 = -1;
17199  if (__pyx_t_12 < 0) {
17200  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17201  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17202  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17203  if (__pyx_t_13 < 0) {
17204  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17205  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17206  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17207  if (__pyx_t_14 < 0) {
17208  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17209  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17210  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17211  if (unlikely(__pyx_t_11 != -1)) {
17212  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17213  __PYX_ERR(0, 791, __pyx_L1_error)
17214  }
17215  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17216 
17217  /* "subsurfaceTransportFunctions.pyx":792
17218  * for k in range(x.shape[1]):
17219  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17220  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17221  * v[eN,k,2]=zvelocity
17222  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17223  */
17224  __pyx_t_15 = __pyx_v_eN;
17225  __pyx_t_16 = __pyx_v_k;
17226  __pyx_t_17 = 0;
17227  __pyx_t_11 = -1;
17228  if (__pyx_t_15 < 0) {
17229  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[0].shape;
17230  if (unlikely(__pyx_t_15 < 0)) __pyx_t_11 = 0;
17231  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17232  if (__pyx_t_16 < 0) {
17233  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[1].shape;
17234  if (unlikely(__pyx_t_16 < 0)) __pyx_t_11 = 1;
17235  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17236  if (__pyx_t_17 < 0) {
17237  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[2].shape;
17238  if (unlikely(__pyx_t_17 < 0)) __pyx_t_11 = 2;
17239  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17240  if (unlikely(__pyx_t_11 != -1)) {
17241  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17242  __PYX_ERR(0, 792, __pyx_L1_error)
17243  }
17244  __pyx_t_18 = __pyx_v_eN;
17245  __pyx_t_19 = __pyx_v_k;
17246  __pyx_t_20 = 1;
17247  __pyx_t_11 = -1;
17248  if (__pyx_t_18 < 0) {
17249  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[0].shape;
17250  if (unlikely(__pyx_t_18 < 0)) __pyx_t_11 = 0;
17251  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17252  if (__pyx_t_19 < 0) {
17253  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[1].shape;
17254  if (unlikely(__pyx_t_19 < 0)) __pyx_t_11 = 1;
17255  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17256  if (__pyx_t_20 < 0) {
17257  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[2].shape;
17258  if (unlikely(__pyx_t_20 < 0)) __pyx_t_11 = 2;
17259  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17260  if (unlikely(__pyx_t_11 != -1)) {
17261  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17262  __PYX_ERR(0, 792, __pyx_L1_error)
17263  }
17264  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[2].strides))));
17265 
17266  /* "subsurfaceTransportFunctions.pyx":793
17267  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17268  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17269  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
17270  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17271  * else:
17272  */
17273  __pyx_t_21 = __pyx_v_eN;
17274  __pyx_t_22 = __pyx_v_k;
17275  __pyx_t_23 = 2;
17276  __pyx_t_11 = -1;
17277  if (__pyx_t_21 < 0) {
17278  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[0].shape;
17279  if (unlikely(__pyx_t_21 < 0)) __pyx_t_11 = 0;
17280  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17281  if (__pyx_t_22 < 0) {
17282  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[1].shape;
17283  if (unlikely(__pyx_t_22 < 0)) __pyx_t_11 = 1;
17284  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17285  if (__pyx_t_23 < 0) {
17286  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[2].shape;
17287  if (unlikely(__pyx_t_23 < 0)) __pyx_t_11 = 2;
17288  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17289  if (unlikely(__pyx_t_11 != -1)) {
17290  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17291  __PYX_ERR(0, 793, __pyx_L1_error)
17292  }
17293  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
17294 
17295  /* "subsurfaceTransportFunctions.pyx":794
17296  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17297  * v[eN,k,2]=zvelocity
17298  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17299  * else:
17300  * for eN in range(x.shape[0]):
17301  */
17302  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 794, __pyx_L1_error)
17303  __Pyx_GOTREF(__pyx_t_24);
17304  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 794, __pyx_L1_error)
17305  __Pyx_GOTREF(__pyx_t_25);
17306  __pyx_t_26 = PyTuple_New(3); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 794, __pyx_L1_error)
17307  __Pyx_GOTREF(__pyx_t_26);
17308  __Pyx_GIVEREF(__pyx_t_24);
17309  PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_24);
17310  __Pyx_GIVEREF(__pyx_t_25);
17311  PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_25);
17312  __Pyx_INCREF(__pyx_slice__3);
17313  __Pyx_GIVEREF(__pyx_slice__3);
17314  PyTuple_SET_ITEM(__pyx_t_26, 2, __pyx_slice__3);
17315  __pyx_t_24 = 0;
17316  __pyx_t_25 = 0;
17317  __pyx_t_25 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_26); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 794, __pyx_L1_error)
17318  __Pyx_GOTREF(__pyx_t_25);
17319  __pyx_t_27 = (__pyx_v_tForReversal - __pyx_v_t);
17320  __pyx_t_28 = (__pyx_v_tForReversal - 0.0);
17321  if (unlikely(__pyx_t_28 == 0)) {
17322  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17323  __PYX_ERR(0, 794, __pyx_L1_error)
17324  }
17325  __pyx_t_24 = PyFloat_FromDouble(((__pyx_t_27 / __pyx_t_28) * __pyx_v_clock)); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 794, __pyx_L1_error)
17326  __Pyx_GOTREF(__pyx_t_24);
17327  __pyx_t_29 = PyNumber_InPlaceMultiply(__pyx_t_25, __pyx_t_24); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 794, __pyx_L1_error)
17328  __Pyx_GOTREF(__pyx_t_29);
17329  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
17330  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
17331  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_26, __pyx_t_29) < 0)) __PYX_ERR(0, 794, __pyx_L1_error)
17332  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
17333  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
17334  }
17335  }
17336 
17337  /* "subsurfaceTransportFunctions.pyx":788
17338  * pi = M_PI
17339  * if v.shape[2] == 3:
17340  * if transient == 1: # <<<<<<<<<<<<<<
17341  * for eN in range(x.shape[0]):
17342  * for k in range(x.shape[1]):
17343  */
17344  goto __pyx_L4;
17345  }
17346 
17347  /* "subsurfaceTransportFunctions.pyx":796
17348  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17349  * else:
17350  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17351  * for k in range(x.shape[1]):
17352  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17353  */
17354  /*else*/ {
17355  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17356  __pyx_t_3 = __pyx_t_2;
17357  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17358  __pyx_v_eN = __pyx_t_4;
17359 
17360  /* "subsurfaceTransportFunctions.pyx":797
17361  * else:
17362  * for eN in range(x.shape[0]):
17363  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17364  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17365  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17366  */
17367  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17368  __pyx_t_6 = __pyx_t_5;
17369  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17370  __pyx_v_k = __pyx_t_7;
17371 
17372  /* "subsurfaceTransportFunctions.pyx":798
17373  * for eN in range(x.shape[0]):
17374  * for k in range(x.shape[1]):
17375  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17376  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17377  * v[eN,k,2]=zvelocity
17378  */
17379  __pyx_t_30 = __pyx_v_eN;
17380  __pyx_t_31 = __pyx_v_k;
17381  __pyx_t_32 = 1;
17382  __pyx_t_11 = -1;
17383  if (__pyx_t_30 < 0) {
17384  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[0].shape;
17385  if (unlikely(__pyx_t_30 < 0)) __pyx_t_11 = 0;
17386  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17387  if (__pyx_t_31 < 0) {
17388  __pyx_t_31 += __pyx_pybuffernd_x.diminfo[1].shape;
17389  if (unlikely(__pyx_t_31 < 0)) __pyx_t_11 = 1;
17390  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17391  if (__pyx_t_32 < 0) {
17392  __pyx_t_32 += __pyx_pybuffernd_x.diminfo[2].shape;
17393  if (unlikely(__pyx_t_32 < 0)) __pyx_t_11 = 2;
17394  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17395  if (unlikely(__pyx_t_11 != -1)) {
17396  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17397  __PYX_ERR(0, 798, __pyx_L1_error)
17398  }
17399  __pyx_t_33 = __pyx_v_eN;
17400  __pyx_t_34 = __pyx_v_k;
17401  __pyx_t_35 = 0;
17402  __pyx_t_11 = -1;
17403  if (__pyx_t_33 < 0) {
17404  __pyx_t_33 += __pyx_pybuffernd_v.diminfo[0].shape;
17405  if (unlikely(__pyx_t_33 < 0)) __pyx_t_11 = 0;
17406  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17407  if (__pyx_t_34 < 0) {
17408  __pyx_t_34 += __pyx_pybuffernd_v.diminfo[1].shape;
17409  if (unlikely(__pyx_t_34 < 0)) __pyx_t_11 = 1;
17410  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17411  if (__pyx_t_35 < 0) {
17412  __pyx_t_35 += __pyx_pybuffernd_v.diminfo[2].shape;
17413  if (unlikely(__pyx_t_35 < 0)) __pyx_t_11 = 2;
17414  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17415  if (unlikely(__pyx_t_11 != -1)) {
17416  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17417  __PYX_ERR(0, 798, __pyx_L1_error)
17418  }
17419  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_35, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_32, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17420 
17421  /* "subsurfaceTransportFunctions.pyx":799
17422  * for k in range(x.shape[1]):
17423  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17424  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17425  * v[eN,k,2]=zvelocity
17426  * else:
17427  */
17428  __pyx_t_36 = __pyx_v_eN;
17429  __pyx_t_37 = __pyx_v_k;
17430  __pyx_t_38 = 0;
17431  __pyx_t_11 = -1;
17432  if (__pyx_t_36 < 0) {
17433  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[0].shape;
17434  if (unlikely(__pyx_t_36 < 0)) __pyx_t_11 = 0;
17435  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17436  if (__pyx_t_37 < 0) {
17437  __pyx_t_37 += __pyx_pybuffernd_x.diminfo[1].shape;
17438  if (unlikely(__pyx_t_37 < 0)) __pyx_t_11 = 1;
17439  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17440  if (__pyx_t_38 < 0) {
17441  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[2].shape;
17442  if (unlikely(__pyx_t_38 < 0)) __pyx_t_11 = 2;
17443  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17444  if (unlikely(__pyx_t_11 != -1)) {
17445  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17446  __PYX_ERR(0, 799, __pyx_L1_error)
17447  }
17448  __pyx_t_39 = __pyx_v_eN;
17449  __pyx_t_40 = __pyx_v_k;
17450  __pyx_t_41 = 1;
17451  __pyx_t_11 = -1;
17452  if (__pyx_t_39 < 0) {
17453  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[0].shape;
17454  if (unlikely(__pyx_t_39 < 0)) __pyx_t_11 = 0;
17455  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17456  if (__pyx_t_40 < 0) {
17457  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[1].shape;
17458  if (unlikely(__pyx_t_40 < 0)) __pyx_t_11 = 1;
17459  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17460  if (__pyx_t_41 < 0) {
17461  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[2].shape;
17462  if (unlikely(__pyx_t_41 < 0)) __pyx_t_11 = 2;
17463  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17464  if (unlikely(__pyx_t_11 != -1)) {
17465  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17466  __PYX_ERR(0, 799, __pyx_L1_error)
17467  }
17468  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_38, __pyx_pybuffernd_x.diminfo[2].strides))));
17469 
17470  /* "subsurfaceTransportFunctions.pyx":800
17471  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17472  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17473  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
17474  * else:
17475  * assert v.shape[2] == 2
17476  */
17477  __pyx_t_42 = __pyx_v_eN;
17478  __pyx_t_43 = __pyx_v_k;
17479  __pyx_t_44 = 2;
17480  __pyx_t_11 = -1;
17481  if (__pyx_t_42 < 0) {
17482  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[0].shape;
17483  if (unlikely(__pyx_t_42 < 0)) __pyx_t_11 = 0;
17484  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17485  if (__pyx_t_43 < 0) {
17486  __pyx_t_43 += __pyx_pybuffernd_v.diminfo[1].shape;
17487  if (unlikely(__pyx_t_43 < 0)) __pyx_t_11 = 1;
17488  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17489  if (__pyx_t_44 < 0) {
17490  __pyx_t_44 += __pyx_pybuffernd_v.diminfo[2].shape;
17491  if (unlikely(__pyx_t_44 < 0)) __pyx_t_11 = 2;
17492  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17493  if (unlikely(__pyx_t_11 != -1)) {
17494  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17495  __PYX_ERR(0, 800, __pyx_L1_error)
17496  }
17497  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
17498  }
17499  }
17500  }
17501  __pyx_L4:;
17502 
17503  /* "subsurfaceTransportFunctions.pyx":787
17504  * cdef double pi
17505  * pi = M_PI
17506  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
17507  * if transient == 1:
17508  * for eN in range(x.shape[0]):
17509  */
17510  goto __pyx_L3;
17511  }
17512 
17513  /* "subsurfaceTransportFunctions.pyx":802
17514  * v[eN,k,2]=zvelocity
17515  * else:
17516  * assert v.shape[2] == 2 # <<<<<<<<<<<<<<
17517  * if transient == 1:
17518  * for eN in range(x.shape[0]):
17519  */
17520  /*else*/ {
17521  #ifndef CYTHON_WITHOUT_ASSERTIONS
17522  if (unlikely(!Py_OptimizeFlag)) {
17523  if (unlikely(!(((__pyx_v_v->dimensions[2]) == 2) != 0))) {
17524  PyErr_SetNone(PyExc_AssertionError);
17525  __PYX_ERR(0, 802, __pyx_L1_error)
17526  }
17527  }
17528  #endif
17529 
17530  /* "subsurfaceTransportFunctions.pyx":803
17531  * else:
17532  * assert v.shape[2] == 2
17533  * if transient == 1: # <<<<<<<<<<<<<<
17534  * for eN in range(x.shape[0]):
17535  * for k in range(x.shape[1]):
17536  */
17537  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17538  if (__pyx_t_1) {
17539 
17540  /* "subsurfaceTransportFunctions.pyx":804
17541  * assert v.shape[2] == 2
17542  * if transient == 1:
17543  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17544  * for k in range(x.shape[1]):
17545  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17546  */
17547  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17548  __pyx_t_3 = __pyx_t_2;
17549  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17550  __pyx_v_eN = __pyx_t_4;
17551 
17552  /* "subsurfaceTransportFunctions.pyx":805
17553  * if transient == 1:
17554  * for eN in range(x.shape[0]):
17555  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17556  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17557  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17558  */
17559  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17560  __pyx_t_6 = __pyx_t_5;
17561  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17562  __pyx_v_k = __pyx_t_7;
17563 
17564  /* "subsurfaceTransportFunctions.pyx":806
17565  * for eN in range(x.shape[0]):
17566  * for k in range(x.shape[1]):
17567  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17568  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17569  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17570  */
17571  __pyx_t_45 = __pyx_v_eN;
17572  __pyx_t_46 = __pyx_v_k;
17573  __pyx_t_47 = 1;
17574  __pyx_t_11 = -1;
17575  if (__pyx_t_45 < 0) {
17576  __pyx_t_45 += __pyx_pybuffernd_x.diminfo[0].shape;
17577  if (unlikely(__pyx_t_45 < 0)) __pyx_t_11 = 0;
17578  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17579  if (__pyx_t_46 < 0) {
17580  __pyx_t_46 += __pyx_pybuffernd_x.diminfo[1].shape;
17581  if (unlikely(__pyx_t_46 < 0)) __pyx_t_11 = 1;
17582  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17583  if (__pyx_t_47 < 0) {
17584  __pyx_t_47 += __pyx_pybuffernd_x.diminfo[2].shape;
17585  if (unlikely(__pyx_t_47 < 0)) __pyx_t_11 = 2;
17586  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17587  if (unlikely(__pyx_t_11 != -1)) {
17588  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17589  __PYX_ERR(0, 806, __pyx_L1_error)
17590  }
17591  __pyx_t_48 = __pyx_v_eN;
17592  __pyx_t_49 = __pyx_v_k;
17593  __pyx_t_50 = 0;
17594  __pyx_t_11 = -1;
17595  if (__pyx_t_48 < 0) {
17596  __pyx_t_48 += __pyx_pybuffernd_v.diminfo[0].shape;
17597  if (unlikely(__pyx_t_48 < 0)) __pyx_t_11 = 0;
17598  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17599  if (__pyx_t_49 < 0) {
17600  __pyx_t_49 += __pyx_pybuffernd_v.diminfo[1].shape;
17601  if (unlikely(__pyx_t_49 < 0)) __pyx_t_11 = 1;
17602  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17603  if (__pyx_t_50 < 0) {
17604  __pyx_t_50 += __pyx_pybuffernd_v.diminfo[2].shape;
17605  if (unlikely(__pyx_t_50 < 0)) __pyx_t_11 = 2;
17606  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17607  if (unlikely(__pyx_t_11 != -1)) {
17608  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17609  __PYX_ERR(0, 806, __pyx_L1_error)
17610  }
17611  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_50, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_47, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17612 
17613  /* "subsurfaceTransportFunctions.pyx":807
17614  * for k in range(x.shape[1]):
17615  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17616  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17617  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17618  * else:
17619  */
17620  __pyx_t_51 = __pyx_v_eN;
17621  __pyx_t_52 = __pyx_v_k;
17622  __pyx_t_53 = 0;
17623  __pyx_t_11 = -1;
17624  if (__pyx_t_51 < 0) {
17625  __pyx_t_51 += __pyx_pybuffernd_x.diminfo[0].shape;
17626  if (unlikely(__pyx_t_51 < 0)) __pyx_t_11 = 0;
17627  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17628  if (__pyx_t_52 < 0) {
17629  __pyx_t_52 += __pyx_pybuffernd_x.diminfo[1].shape;
17630  if (unlikely(__pyx_t_52 < 0)) __pyx_t_11 = 1;
17631  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17632  if (__pyx_t_53 < 0) {
17633  __pyx_t_53 += __pyx_pybuffernd_x.diminfo[2].shape;
17634  if (unlikely(__pyx_t_53 < 0)) __pyx_t_11 = 2;
17635  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17636  if (unlikely(__pyx_t_11 != -1)) {
17637  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17638  __PYX_ERR(0, 807, __pyx_L1_error)
17639  }
17640  __pyx_t_54 = __pyx_v_eN;
17641  __pyx_t_55 = __pyx_v_k;
17642  __pyx_t_56 = 1;
17643  __pyx_t_11 = -1;
17644  if (__pyx_t_54 < 0) {
17645  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[0].shape;
17646  if (unlikely(__pyx_t_54 < 0)) __pyx_t_11 = 0;
17647  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17648  if (__pyx_t_55 < 0) {
17649  __pyx_t_55 += __pyx_pybuffernd_v.diminfo[1].shape;
17650  if (unlikely(__pyx_t_55 < 0)) __pyx_t_11 = 1;
17651  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17652  if (__pyx_t_56 < 0) {
17653  __pyx_t_56 += __pyx_pybuffernd_v.diminfo[2].shape;
17654  if (unlikely(__pyx_t_56 < 0)) __pyx_t_11 = 2;
17655  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17656  if (unlikely(__pyx_t_11 != -1)) {
17657  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17658  __PYX_ERR(0, 807, __pyx_L1_error)
17659  }
17660  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_53, __pyx_pybuffernd_x.diminfo[2].strides))));
17661 
17662  /* "subsurfaceTransportFunctions.pyx":808
17663  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17664  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17665  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17666  * else:
17667  * for eN in range(x.shape[0]):
17668  */
17669  __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 808, __pyx_L1_error)
17670  __Pyx_GOTREF(__pyx_t_26);
17671  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 808, __pyx_L1_error)
17672  __Pyx_GOTREF(__pyx_t_29);
17673  __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 808, __pyx_L1_error)
17674  __Pyx_GOTREF(__pyx_t_24);
17675  __Pyx_GIVEREF(__pyx_t_26);
17676  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_26);
17677  __Pyx_GIVEREF(__pyx_t_29);
17678  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_29);
17679  __Pyx_INCREF(__pyx_slice__4);
17680  __Pyx_GIVEREF(__pyx_slice__4);
17681  PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_slice__4);
17682  __pyx_t_26 = 0;
17683  __pyx_t_29 = 0;
17684  __pyx_t_29 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_24); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 808, __pyx_L1_error)
17685  __Pyx_GOTREF(__pyx_t_29);
17686  __pyx_t_28 = (__pyx_v_tForReversal - __pyx_v_t);
17687  __pyx_t_27 = (__pyx_v_tForReversal - 0.0);
17688  if (unlikely(__pyx_t_27 == 0)) {
17689  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17690  __PYX_ERR(0, 808, __pyx_L1_error)
17691  }
17692  __pyx_t_26 = PyFloat_FromDouble(((__pyx_t_28 / __pyx_t_27) * __pyx_v_clock)); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 808, __pyx_L1_error)
17693  __Pyx_GOTREF(__pyx_t_26);
17694  __pyx_t_25 = PyNumber_InPlaceMultiply(__pyx_t_29, __pyx_t_26); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 808, __pyx_L1_error)
17695  __Pyx_GOTREF(__pyx_t_25);
17696  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
17697  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
17698  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_24, __pyx_t_25) < 0)) __PYX_ERR(0, 808, __pyx_L1_error)
17699  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
17700  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
17701  }
17702  }
17703 
17704  /* "subsurfaceTransportFunctions.pyx":803
17705  * else:
17706  * assert v.shape[2] == 2
17707  * if transient == 1: # <<<<<<<<<<<<<<
17708  * for eN in range(x.shape[0]):
17709  * for k in range(x.shape[1]):
17710  */
17711  goto __pyx_L13;
17712  }
17713 
17714  /* "subsurfaceTransportFunctions.pyx":810
17715  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17716  * else:
17717  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17718  * for k in range(x.shape[1]):
17719  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17720  */
17721  /*else*/ {
17722  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17723  __pyx_t_3 = __pyx_t_2;
17724  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17725  __pyx_v_eN = __pyx_t_4;
17726 
17727  /* "subsurfaceTransportFunctions.pyx":811
17728  * else:
17729  * for eN in range(x.shape[0]):
17730  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17731  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17732  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17733  */
17734  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17735  __pyx_t_6 = __pyx_t_5;
17736  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17737  __pyx_v_k = __pyx_t_7;
17738 
17739  /* "subsurfaceTransportFunctions.pyx":812
17740  * for eN in range(x.shape[0]):
17741  * for k in range(x.shape[1]):
17742  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17743  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17744  *
17745  */
17746  __pyx_t_57 = __pyx_v_eN;
17747  __pyx_t_58 = __pyx_v_k;
17748  __pyx_t_59 = 1;
17749  __pyx_t_11 = -1;
17750  if (__pyx_t_57 < 0) {
17751  __pyx_t_57 += __pyx_pybuffernd_x.diminfo[0].shape;
17752  if (unlikely(__pyx_t_57 < 0)) __pyx_t_11 = 0;
17753  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17754  if (__pyx_t_58 < 0) {
17755  __pyx_t_58 += __pyx_pybuffernd_x.diminfo[1].shape;
17756  if (unlikely(__pyx_t_58 < 0)) __pyx_t_11 = 1;
17757  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17758  if (__pyx_t_59 < 0) {
17759  __pyx_t_59 += __pyx_pybuffernd_x.diminfo[2].shape;
17760  if (unlikely(__pyx_t_59 < 0)) __pyx_t_11 = 2;
17761  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17762  if (unlikely(__pyx_t_11 != -1)) {
17763  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17764  __PYX_ERR(0, 812, __pyx_L1_error)
17765  }
17766  __pyx_t_60 = __pyx_v_eN;
17767  __pyx_t_61 = __pyx_v_k;
17768  __pyx_t_62 = 0;
17769  __pyx_t_11 = -1;
17770  if (__pyx_t_60 < 0) {
17771  __pyx_t_60 += __pyx_pybuffernd_v.diminfo[0].shape;
17772  if (unlikely(__pyx_t_60 < 0)) __pyx_t_11 = 0;
17773  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17774  if (__pyx_t_61 < 0) {
17775  __pyx_t_61 += __pyx_pybuffernd_v.diminfo[1].shape;
17776  if (unlikely(__pyx_t_61 < 0)) __pyx_t_11 = 1;
17777  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17778  if (__pyx_t_62 < 0) {
17779  __pyx_t_62 += __pyx_pybuffernd_v.diminfo[2].shape;
17780  if (unlikely(__pyx_t_62 < 0)) __pyx_t_11 = 2;
17781  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17782  if (unlikely(__pyx_t_11 != -1)) {
17783  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17784  __PYX_ERR(0, 812, __pyx_L1_error)
17785  }
17786  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_62, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_58, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_59, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17787 
17788  /* "subsurfaceTransportFunctions.pyx":813
17789  * for k in range(x.shape[1]):
17790  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17791  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17792  *
17793  *
17794  */
17795  __pyx_t_63 = __pyx_v_eN;
17796  __pyx_t_64 = __pyx_v_k;
17797  __pyx_t_65 = 0;
17798  __pyx_t_11 = -1;
17799  if (__pyx_t_63 < 0) {
17800  __pyx_t_63 += __pyx_pybuffernd_x.diminfo[0].shape;
17801  if (unlikely(__pyx_t_63 < 0)) __pyx_t_11 = 0;
17802  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17803  if (__pyx_t_64 < 0) {
17804  __pyx_t_64 += __pyx_pybuffernd_x.diminfo[1].shape;
17805  if (unlikely(__pyx_t_64 < 0)) __pyx_t_11 = 1;
17806  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17807  if (__pyx_t_65 < 0) {
17808  __pyx_t_65 += __pyx_pybuffernd_x.diminfo[2].shape;
17809  if (unlikely(__pyx_t_65 < 0)) __pyx_t_11 = 2;
17810  } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17811  if (unlikely(__pyx_t_11 != -1)) {
17812  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17813  __PYX_ERR(0, 813, __pyx_L1_error)
17814  }
17815  __pyx_t_66 = __pyx_v_eN;
17816  __pyx_t_67 = __pyx_v_k;
17817  __pyx_t_68 = 1;
17818  __pyx_t_11 = -1;
17819  if (__pyx_t_66 < 0) {
17820  __pyx_t_66 += __pyx_pybuffernd_v.diminfo[0].shape;
17821  if (unlikely(__pyx_t_66 < 0)) __pyx_t_11 = 0;
17822  } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17823  if (__pyx_t_67 < 0) {
17824  __pyx_t_67 += __pyx_pybuffernd_v.diminfo[1].shape;
17825  if (unlikely(__pyx_t_67 < 0)) __pyx_t_11 = 1;
17826  } else if (unlikely(__pyx_t_67 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17827  if (__pyx_t_68 < 0) {
17828  __pyx_t_68 += __pyx_pybuffernd_v.diminfo[2].shape;
17829  if (unlikely(__pyx_t_68 < 0)) __pyx_t_11 = 2;
17830  } else if (unlikely(__pyx_t_68 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17831  if (unlikely(__pyx_t_11 != -1)) {
17832  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17833  __PYX_ERR(0, 813, __pyx_L1_error)
17834  }
17835  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_68, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_65, __pyx_pybuffernd_x.diminfo[2].strides))));
17836  }
17837  }
17838  }
17839  __pyx_L13:;
17840  }
17841  __pyx_L3:;
17842 
17843  /* "subsurfaceTransportFunctions.pyx":776
17844  *
17845  * #problem specific velocity evaluation
17846  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
17847  * double t,
17848  * double tForReversal,
17849  */
17850 
17851  /* function exit code */
17852  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17853  goto __pyx_L0;
17854  __pyx_L1_error:;
17855  __Pyx_XDECREF(__pyx_t_24);
17856  __Pyx_XDECREF(__pyx_t_25);
17857  __Pyx_XDECREF(__pyx_t_26);
17858  __Pyx_XDECREF(__pyx_t_29);
17859  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
17860  __Pyx_PyThreadState_declare
17861  __Pyx_PyThreadState_assign
17862  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
17863  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17864  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17865  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
17866  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
17867  __pyx_r = NULL;
17868  goto __pyx_L2;
17869  __pyx_L0:;
17870  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17871  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17872  __pyx_L2:;
17873  __Pyx_XGIVEREF(__pyx_r);
17874  __Pyx_RefNannyFinishContext();
17875  return __pyx_r;
17876 }
17877 
17878 /* "subsurfaceTransportFunctions.pyx":816
17879  *
17880  *
17881  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
17882  * double t,
17883  * double tForReversal,
17884  */
17885 
17886 /* Python wrapper */
17887 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17888 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4 = {"rotatingGaussianElementVelocityEval4", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
17889 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17890  int __pyx_v_transient;
17891  double __pyx_v_t;
17892  double __pyx_v_tForReversal;
17893  double __pyx_v_clock;
17894  double __pyx_v_xc;
17895  double __pyx_v_yc;
17896  PyArrayObject *__pyx_v_x = 0;
17897  PyArrayObject *__pyx_v_v = 0;
17898  double __pyx_v_zvelocity;
17899  PyObject *__pyx_r = 0;
17900  __Pyx_RefNannyDeclarations
17901  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4 (wrapper)", 0);
17902  {
17903  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
17904  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
17905  if (unlikely(__pyx_kwds)) {
17906  Py_ssize_t kw_args;
17907  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17908  switch (pos_args) {
17909  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17910  CYTHON_FALLTHROUGH;
17911  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17912  CYTHON_FALLTHROUGH;
17913  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17914  CYTHON_FALLTHROUGH;
17915  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17916  CYTHON_FALLTHROUGH;
17917  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17918  CYTHON_FALLTHROUGH;
17919  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17920  CYTHON_FALLTHROUGH;
17921  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17922  CYTHON_FALLTHROUGH;
17923  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17924  CYTHON_FALLTHROUGH;
17925  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17926  CYTHON_FALLTHROUGH;
17927  case 0: break;
17928  default: goto __pyx_L5_argtuple_error;
17929  }
17930  kw_args = PyDict_Size(__pyx_kwds);
17931  switch (pos_args) {
17932  case 0:
17933  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
17934  else goto __pyx_L5_argtuple_error;
17935  CYTHON_FALLTHROUGH;
17936  case 1:
17937  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
17938  else {
17939  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 1); __PYX_ERR(0, 816, __pyx_L3_error)
17940  }
17941  CYTHON_FALLTHROUGH;
17942  case 2:
17943  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
17944  else {
17945  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 2); __PYX_ERR(0, 816, __pyx_L3_error)
17946  }
17947  CYTHON_FALLTHROUGH;
17948  case 3:
17949  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
17950  else {
17951  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 3); __PYX_ERR(0, 816, __pyx_L3_error)
17952  }
17953  CYTHON_FALLTHROUGH;
17954  case 4:
17955  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
17956  else {
17957  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 4); __PYX_ERR(0, 816, __pyx_L3_error)
17958  }
17959  CYTHON_FALLTHROUGH;
17960  case 5:
17961  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
17962  else {
17963  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 5); __PYX_ERR(0, 816, __pyx_L3_error)
17964  }
17965  CYTHON_FALLTHROUGH;
17966  case 6:
17967  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
17968  else {
17969  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 6); __PYX_ERR(0, 816, __pyx_L3_error)
17970  }
17971  CYTHON_FALLTHROUGH;
17972  case 7:
17973  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
17974  else {
17975  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 7); __PYX_ERR(0, 816, __pyx_L3_error)
17976  }
17977  CYTHON_FALLTHROUGH;
17978  case 8:
17979  if (kw_args > 0) {
17980  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zvelocity);
17981  if (value) { values[8] = value; kw_args--; }
17982  }
17983  }
17984  if (unlikely(kw_args > 0)) {
17985  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval4") < 0)) __PYX_ERR(0, 816, __pyx_L3_error)
17986  }
17987  } else {
17988  switch (PyTuple_GET_SIZE(__pyx_args)) {
17989  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17990  CYTHON_FALLTHROUGH;
17991  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17992  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17993  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17994  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17995  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17996  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17997  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17998  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17999  break;
18000  default: goto __pyx_L5_argtuple_error;
18001  }
18002  }
18003  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L3_error)
18004  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L3_error)
18005  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 818, __pyx_L3_error)
18006  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L3_error)
18007  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
18008  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
18009  __pyx_v_x = ((PyArrayObject *)values[6]);
18010  __pyx_v_v = ((PyArrayObject *)values[7]);
18011  if (values[8]) {
18012  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L3_error)
18013  } else {
18014  __pyx_v_zvelocity = ((double)0.0);
18015  }
18016  }
18017  goto __pyx_L4_argument_unpacking_done;
18018  __pyx_L5_argtuple_error:;
18019  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 816, __pyx_L3_error)
18020  __pyx_L3_error:;
18021  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
18022  __Pyx_RefNannyFinishContext();
18023  return NULL;
18024  __pyx_L4_argument_unpacking_done:;
18025  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 821, __pyx_L1_error)
18026  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 822, __pyx_L1_error)
18027  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
18028 
18029  /* function exit code */
18030  goto __pyx_L0;
18031  __pyx_L1_error:;
18032  __pyx_r = NULL;
18033  __pyx_L0:;
18034  __Pyx_RefNannyFinishContext();
18035  return __pyx_r;
18036 }
18037 
18038 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
18039  int __pyx_v_eN;
18040  int __pyx_v_ebN;
18041  int __pyx_v_k;
18042  double __pyx_v_pi;
18043  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
18044  __Pyx_Buffer __pyx_pybuffer_v;
18045  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
18046  __Pyx_Buffer __pyx_pybuffer_x;
18047  PyObject *__pyx_r = NULL;
18048  __Pyx_RefNannyDeclarations
18049  int __pyx_t_1;
18050  npy_intp __pyx_t_2;
18051  npy_intp __pyx_t_3;
18052  int __pyx_t_4;
18053  npy_intp __pyx_t_5;
18054  npy_intp __pyx_t_6;
18055  int __pyx_t_7;
18056  npy_intp __pyx_t_8;
18057  npy_intp __pyx_t_9;
18058  int __pyx_t_10;
18059  Py_ssize_t __pyx_t_11;
18060  Py_ssize_t __pyx_t_12;
18061  Py_ssize_t __pyx_t_13;
18062  Py_ssize_t __pyx_t_14;
18063  int __pyx_t_15;
18064  Py_ssize_t __pyx_t_16;
18065  Py_ssize_t __pyx_t_17;
18066  Py_ssize_t __pyx_t_18;
18067  Py_ssize_t __pyx_t_19;
18068  Py_ssize_t __pyx_t_20;
18069  Py_ssize_t __pyx_t_21;
18070  Py_ssize_t __pyx_t_22;
18071  Py_ssize_t __pyx_t_23;
18072  Py_ssize_t __pyx_t_24;
18073  Py_ssize_t __pyx_t_25;
18074  Py_ssize_t __pyx_t_26;
18075  Py_ssize_t __pyx_t_27;
18076  Py_ssize_t __pyx_t_28;
18077  Py_ssize_t __pyx_t_29;
18078  Py_ssize_t __pyx_t_30;
18079  Py_ssize_t __pyx_t_31;
18080  PyObject *__pyx_t_32 = NULL;
18081  PyObject *__pyx_t_33 = NULL;
18082  PyObject *__pyx_t_34 = NULL;
18083  PyObject *__pyx_t_35 = NULL;
18084  double __pyx_t_36;
18085  double __pyx_t_37;
18086  Py_ssize_t __pyx_t_38;
18087  Py_ssize_t __pyx_t_39;
18088  Py_ssize_t __pyx_t_40;
18089  Py_ssize_t __pyx_t_41;
18090  Py_ssize_t __pyx_t_42;
18091  Py_ssize_t __pyx_t_43;
18092  Py_ssize_t __pyx_t_44;
18093  Py_ssize_t __pyx_t_45;
18094  Py_ssize_t __pyx_t_46;
18095  Py_ssize_t __pyx_t_47;
18096  Py_ssize_t __pyx_t_48;
18097  Py_ssize_t __pyx_t_49;
18098  Py_ssize_t __pyx_t_50;
18099  Py_ssize_t __pyx_t_51;
18100  Py_ssize_t __pyx_t_52;
18101  Py_ssize_t __pyx_t_53;
18102  Py_ssize_t __pyx_t_54;
18103  Py_ssize_t __pyx_t_55;
18104  Py_ssize_t __pyx_t_56;
18105  Py_ssize_t __pyx_t_57;
18106  Py_ssize_t __pyx_t_58;
18107  Py_ssize_t __pyx_t_59;
18108  Py_ssize_t __pyx_t_60;
18109  Py_ssize_t __pyx_t_61;
18110  Py_ssize_t __pyx_t_62;
18111  Py_ssize_t __pyx_t_63;
18112  Py_ssize_t __pyx_t_64;
18113  Py_ssize_t __pyx_t_65;
18114  Py_ssize_t __pyx_t_66;
18115  Py_ssize_t __pyx_t_67;
18116  Py_ssize_t __pyx_t_68;
18117  Py_ssize_t __pyx_t_69;
18118  Py_ssize_t __pyx_t_70;
18119  Py_ssize_t __pyx_t_71;
18120  Py_ssize_t __pyx_t_72;
18121  Py_ssize_t __pyx_t_73;
18122  Py_ssize_t __pyx_t_74;
18123  Py_ssize_t __pyx_t_75;
18124  Py_ssize_t __pyx_t_76;
18125  Py_ssize_t __pyx_t_77;
18126  Py_ssize_t __pyx_t_78;
18127  Py_ssize_t __pyx_t_79;
18128  Py_ssize_t __pyx_t_80;
18129  Py_ssize_t __pyx_t_81;
18130  Py_ssize_t __pyx_t_82;
18131  Py_ssize_t __pyx_t_83;
18132  Py_ssize_t __pyx_t_84;
18133  Py_ssize_t __pyx_t_85;
18134  Py_ssize_t __pyx_t_86;
18135  Py_ssize_t __pyx_t_87;
18136  Py_ssize_t __pyx_t_88;
18137  Py_ssize_t __pyx_t_89;
18138  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4", 0);
18139  __pyx_pybuffer_x.pybuffer.buf = NULL;
18140  __pyx_pybuffer_x.refcount = 0;
18141  __pyx_pybuffernd_x.data = NULL;
18142  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
18143  __pyx_pybuffer_v.pybuffer.buf = NULL;
18144  __pyx_pybuffer_v.refcount = 0;
18145  __pyx_pybuffernd_v.data = NULL;
18146  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
18147  {
18148  __Pyx_BufFmt_StackElem __pyx_stack[1];
18149  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 816, __pyx_L1_error)
18150  }
18151  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
18152  {
18153  __Pyx_BufFmt_StackElem __pyx_stack[1];
18154  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 816, __pyx_L1_error)
18155  }
18156  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
18157 
18158  /* "subsurfaceTransportFunctions.pyx":826
18159  * cdef int eN,ebN,k
18160  * cdef double pi
18161  * pi = M_PI # <<<<<<<<<<<<<<
18162  * if v.shape[v.ndim-1] == 3:
18163  * if transient == 1:
18164  */
18165  __pyx_v_pi = M_PI;
18166 
18167  /* "subsurfaceTransportFunctions.pyx":827
18168  * cdef double pi
18169  * pi = M_PI
18170  * if v.shape[v.ndim-1] == 3: # <<<<<<<<<<<<<<
18171  * if transient == 1:
18172  * for eN in range(x.shape[0]):
18173  */
18174  __pyx_t_1 = (((__pyx_v_v->dimensions[(__pyx_v_v->nd - 1)]) == 3) != 0);
18175  if (__pyx_t_1) {
18176 
18177  /* "subsurfaceTransportFunctions.pyx":828
18178  * pi = M_PI
18179  * if v.shape[v.ndim-1] == 3:
18180  * if transient == 1: # <<<<<<<<<<<<<<
18181  * for eN in range(x.shape[0]):
18182  * for ebN in range(x.shape[1]):
18183  */
18184  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18185  if (__pyx_t_1) {
18186 
18187  /* "subsurfaceTransportFunctions.pyx":829
18188  * if v.shape[v.ndim-1] == 3:
18189  * if transient == 1:
18190  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18191  * for ebN in range(x.shape[1]):
18192  * for k in range(x.shape[2]):
18193  */
18194  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18195  __pyx_t_3 = __pyx_t_2;
18196  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18197  __pyx_v_eN = __pyx_t_4;
18198 
18199  /* "subsurfaceTransportFunctions.pyx":830
18200  * if transient == 1:
18201  * for eN in range(x.shape[0]):
18202  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18203  * for k in range(x.shape[2]):
18204  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18205  */
18206  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18207  __pyx_t_6 = __pyx_t_5;
18208  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18209  __pyx_v_ebN = __pyx_t_7;
18210 
18211  /* "subsurfaceTransportFunctions.pyx":831
18212  * for eN in range(x.shape[0]):
18213  * for ebN in range(x.shape[1]):
18214  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18215  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18216  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18217  */
18218  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18219  __pyx_t_9 = __pyx_t_8;
18220  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18221  __pyx_v_k = __pyx_t_10;
18222 
18223  /* "subsurfaceTransportFunctions.pyx":832
18224  * for ebN in range(x.shape[1]):
18225  * for k in range(x.shape[2]):
18226  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18227  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18228  * v[eN,ebN,k,2]=zvelocity
18229  */
18230  __pyx_t_11 = __pyx_v_eN;
18231  __pyx_t_12 = __pyx_v_ebN;
18232  __pyx_t_13 = __pyx_v_k;
18233  __pyx_t_14 = 1;
18234  __pyx_t_15 = -1;
18235  if (__pyx_t_11 < 0) {
18236  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18237  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18238  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18239  if (__pyx_t_12 < 0) {
18240  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18241  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18242  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18243  if (__pyx_t_13 < 0) {
18244  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18245  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18246  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18247  if (__pyx_t_14 < 0) {
18248  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18249  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18250  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18251  if (unlikely(__pyx_t_15 != -1)) {
18252  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18253  __PYX_ERR(0, 832, __pyx_L1_error)
18254  }
18255  __pyx_t_16 = __pyx_v_eN;
18256  __pyx_t_17 = __pyx_v_ebN;
18257  __pyx_t_18 = __pyx_v_k;
18258  __pyx_t_19 = 0;
18259  __pyx_t_15 = -1;
18260  if (__pyx_t_16 < 0) {
18261  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18262  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18263  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18264  if (__pyx_t_17 < 0) {
18265  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18266  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18267  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18268  if (__pyx_t_18 < 0) {
18269  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18270  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18271  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18272  if (__pyx_t_19 < 0) {
18273  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18274  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18275  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18276  if (unlikely(__pyx_t_15 != -1)) {
18277  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18278  __PYX_ERR(0, 832, __pyx_L1_error)
18279  }
18280  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18281 
18282  /* "subsurfaceTransportFunctions.pyx":833
18283  * for k in range(x.shape[2]):
18284  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18285  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18286  * v[eN,ebN,k,2]=zvelocity
18287  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18288  */
18289  __pyx_t_20 = __pyx_v_eN;
18290  __pyx_t_21 = __pyx_v_ebN;
18291  __pyx_t_22 = __pyx_v_k;
18292  __pyx_t_23 = 0;
18293  __pyx_t_15 = -1;
18294  if (__pyx_t_20 < 0) {
18295  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[0].shape;
18296  if (unlikely(__pyx_t_20 < 0)) __pyx_t_15 = 0;
18297  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18298  if (__pyx_t_21 < 0) {
18299  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[1].shape;
18300  if (unlikely(__pyx_t_21 < 0)) __pyx_t_15 = 1;
18301  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18302  if (__pyx_t_22 < 0) {
18303  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[2].shape;
18304  if (unlikely(__pyx_t_22 < 0)) __pyx_t_15 = 2;
18305  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18306  if (__pyx_t_23 < 0) {
18307  __pyx_t_23 += __pyx_pybuffernd_x.diminfo[3].shape;
18308  if (unlikely(__pyx_t_23 < 0)) __pyx_t_15 = 3;
18309  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18310  if (unlikely(__pyx_t_15 != -1)) {
18311  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18312  __PYX_ERR(0, 833, __pyx_L1_error)
18313  }
18314  __pyx_t_24 = __pyx_v_eN;
18315  __pyx_t_25 = __pyx_v_ebN;
18316  __pyx_t_26 = __pyx_v_k;
18317  __pyx_t_27 = 1;
18318  __pyx_t_15 = -1;
18319  if (__pyx_t_24 < 0) {
18320  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[0].shape;
18321  if (unlikely(__pyx_t_24 < 0)) __pyx_t_15 = 0;
18322  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18323  if (__pyx_t_25 < 0) {
18324  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[1].shape;
18325  if (unlikely(__pyx_t_25 < 0)) __pyx_t_15 = 1;
18326  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18327  if (__pyx_t_26 < 0) {
18328  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[2].shape;
18329  if (unlikely(__pyx_t_26 < 0)) __pyx_t_15 = 2;
18330  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18331  if (__pyx_t_27 < 0) {
18332  __pyx_t_27 += __pyx_pybuffernd_v.diminfo[3].shape;
18333  if (unlikely(__pyx_t_27 < 0)) __pyx_t_15 = 3;
18334  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18335  if (unlikely(__pyx_t_15 != -1)) {
18336  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18337  __PYX_ERR(0, 833, __pyx_L1_error)
18338  }
18339  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_27, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_23, __pyx_pybuffernd_x.diminfo[3].strides))));
18340 
18341  /* "subsurfaceTransportFunctions.pyx":834
18342  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18343  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18344  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
18345  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18346  * else:
18347  */
18348  __pyx_t_28 = __pyx_v_eN;
18349  __pyx_t_29 = __pyx_v_ebN;
18350  __pyx_t_30 = __pyx_v_k;
18351  __pyx_t_31 = 2;
18352  __pyx_t_15 = -1;
18353  if (__pyx_t_28 < 0) {
18354  __pyx_t_28 += __pyx_pybuffernd_v.diminfo[0].shape;
18355  if (unlikely(__pyx_t_28 < 0)) __pyx_t_15 = 0;
18356  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18357  if (__pyx_t_29 < 0) {
18358  __pyx_t_29 += __pyx_pybuffernd_v.diminfo[1].shape;
18359  if (unlikely(__pyx_t_29 < 0)) __pyx_t_15 = 1;
18360  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18361  if (__pyx_t_30 < 0) {
18362  __pyx_t_30 += __pyx_pybuffernd_v.diminfo[2].shape;
18363  if (unlikely(__pyx_t_30 < 0)) __pyx_t_15 = 2;
18364  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18365  if (__pyx_t_31 < 0) {
18366  __pyx_t_31 += __pyx_pybuffernd_v.diminfo[3].shape;
18367  if (unlikely(__pyx_t_31 < 0)) __pyx_t_15 = 3;
18368  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18369  if (unlikely(__pyx_t_15 != -1)) {
18370  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18371  __PYX_ERR(0, 834, __pyx_L1_error)
18372  }
18373  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_31, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
18374 
18375  /* "subsurfaceTransportFunctions.pyx":835
18376  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18377  * v[eN,ebN,k,2]=zvelocity
18378  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
18379  * else:
18380  * for eN in range(x.shape[0]):
18381  */
18382  __pyx_t_32 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 835, __pyx_L1_error)
18383  __Pyx_GOTREF(__pyx_t_32);
18384  __pyx_t_33 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 835, __pyx_L1_error)
18385  __Pyx_GOTREF(__pyx_t_33);
18386  __pyx_t_34 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 835, __pyx_L1_error)
18387  __Pyx_GOTREF(__pyx_t_34);
18388  __pyx_t_35 = PyTuple_New(4); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 835, __pyx_L1_error)
18389  __Pyx_GOTREF(__pyx_t_35);
18390  __Pyx_GIVEREF(__pyx_t_32);
18391  PyTuple_SET_ITEM(__pyx_t_35, 0, __pyx_t_32);
18392  __Pyx_GIVEREF(__pyx_t_33);
18393  PyTuple_SET_ITEM(__pyx_t_35, 1, __pyx_t_33);
18394  __Pyx_GIVEREF(__pyx_t_34);
18395  PyTuple_SET_ITEM(__pyx_t_35, 2, __pyx_t_34);
18396  __Pyx_INCREF(__pyx_slice__5);
18397  __Pyx_GIVEREF(__pyx_slice__5);
18398  PyTuple_SET_ITEM(__pyx_t_35, 3, __pyx_slice__5);
18399  __pyx_t_32 = 0;
18400  __pyx_t_33 = 0;
18401  __pyx_t_34 = 0;
18402  __pyx_t_34 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_35); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 835, __pyx_L1_error)
18403  __Pyx_GOTREF(__pyx_t_34);
18404  __pyx_t_36 = (__pyx_v_tForReversal - __pyx_v_t);
18405  __pyx_t_37 = (__pyx_v_tForReversal - 0.0);
18406  if (unlikely(__pyx_t_37 == 0)) {
18407  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18408  __PYX_ERR(0, 835, __pyx_L1_error)
18409  }
18410  __pyx_t_33 = PyFloat_FromDouble(((__pyx_t_36 / __pyx_t_37) * __pyx_v_clock)); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 835, __pyx_L1_error)
18411  __Pyx_GOTREF(__pyx_t_33);
18412  __pyx_t_32 = PyNumber_InPlaceMultiply(__pyx_t_34, __pyx_t_33); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 835, __pyx_L1_error)
18413  __Pyx_GOTREF(__pyx_t_32);
18414  __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
18415  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
18416  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_35, __pyx_t_32) < 0)) __PYX_ERR(0, 835, __pyx_L1_error)
18417  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
18418  __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
18419  }
18420  }
18421  }
18422 
18423  /* "subsurfaceTransportFunctions.pyx":828
18424  * pi = M_PI
18425  * if v.shape[v.ndim-1] == 3:
18426  * if transient == 1: # <<<<<<<<<<<<<<
18427  * for eN in range(x.shape[0]):
18428  * for ebN in range(x.shape[1]):
18429  */
18430  goto __pyx_L4;
18431  }
18432 
18433  /* "subsurfaceTransportFunctions.pyx":837
18434  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18435  * else:
18436  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18437  * for ebN in range(x.shape[1]):
18438  * for k in range(x.shape[2]):
18439  */
18440  /*else*/ {
18441  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18442  __pyx_t_3 = __pyx_t_2;
18443  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18444  __pyx_v_eN = __pyx_t_4;
18445 
18446  /* "subsurfaceTransportFunctions.pyx":838
18447  * else:
18448  * for eN in range(x.shape[0]):
18449  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18450  * for k in range(x.shape[2]):
18451  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18452  */
18453  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18454  __pyx_t_6 = __pyx_t_5;
18455  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18456  __pyx_v_ebN = __pyx_t_7;
18457 
18458  /* "subsurfaceTransportFunctions.pyx":839
18459  * for eN in range(x.shape[0]):
18460  * for ebN in range(x.shape[1]):
18461  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18462  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18463  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18464  */
18465  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18466  __pyx_t_9 = __pyx_t_8;
18467  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18468  __pyx_v_k = __pyx_t_10;
18469 
18470  /* "subsurfaceTransportFunctions.pyx":840
18471  * for ebN in range(x.shape[1]):
18472  * for k in range(x.shape[2]):
18473  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18474  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18475  * v[eN,ebN,k,2]=zvelocity
18476  */
18477  __pyx_t_38 = __pyx_v_eN;
18478  __pyx_t_39 = __pyx_v_ebN;
18479  __pyx_t_40 = __pyx_v_k;
18480  __pyx_t_41 = 1;
18481  __pyx_t_15 = -1;
18482  if (__pyx_t_38 < 0) {
18483  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[0].shape;
18484  if (unlikely(__pyx_t_38 < 0)) __pyx_t_15 = 0;
18485  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18486  if (__pyx_t_39 < 0) {
18487  __pyx_t_39 += __pyx_pybuffernd_x.diminfo[1].shape;
18488  if (unlikely(__pyx_t_39 < 0)) __pyx_t_15 = 1;
18489  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18490  if (__pyx_t_40 < 0) {
18491  __pyx_t_40 += __pyx_pybuffernd_x.diminfo[2].shape;
18492  if (unlikely(__pyx_t_40 < 0)) __pyx_t_15 = 2;
18493  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18494  if (__pyx_t_41 < 0) {
18495  __pyx_t_41 += __pyx_pybuffernd_x.diminfo[3].shape;
18496  if (unlikely(__pyx_t_41 < 0)) __pyx_t_15 = 3;
18497  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18498  if (unlikely(__pyx_t_15 != -1)) {
18499  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18500  __PYX_ERR(0, 840, __pyx_L1_error)
18501  }
18502  __pyx_t_42 = __pyx_v_eN;
18503  __pyx_t_43 = __pyx_v_ebN;
18504  __pyx_t_44 = __pyx_v_k;
18505  __pyx_t_45 = 0;
18506  __pyx_t_15 = -1;
18507  if (__pyx_t_42 < 0) {
18508  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[0].shape;
18509  if (unlikely(__pyx_t_42 < 0)) __pyx_t_15 = 0;
18510  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18511  if (__pyx_t_43 < 0) {
18512  __pyx_t_43 += __pyx_pybuffernd_v.diminfo[1].shape;
18513  if (unlikely(__pyx_t_43 < 0)) __pyx_t_15 = 1;
18514  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18515  if (__pyx_t_44 < 0) {
18516  __pyx_t_44 += __pyx_pybuffernd_v.diminfo[2].shape;
18517  if (unlikely(__pyx_t_44 < 0)) __pyx_t_15 = 2;
18518  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18519  if (__pyx_t_45 < 0) {
18520  __pyx_t_45 += __pyx_pybuffernd_v.diminfo[3].shape;
18521  if (unlikely(__pyx_t_45 < 0)) __pyx_t_15 = 3;
18522  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18523  if (unlikely(__pyx_t_15 != -1)) {
18524  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18525  __PYX_ERR(0, 840, __pyx_L1_error)
18526  }
18527  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_45, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_40, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_41, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18528 
18529  /* "subsurfaceTransportFunctions.pyx":841
18530  * for k in range(x.shape[2]):
18531  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18532  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18533  * v[eN,ebN,k,2]=zvelocity
18534  * else:
18535  */
18536  __pyx_t_46 = __pyx_v_eN;
18537  __pyx_t_47 = __pyx_v_ebN;
18538  __pyx_t_48 = __pyx_v_k;
18539  __pyx_t_49 = 0;
18540  __pyx_t_15 = -1;
18541  if (__pyx_t_46 < 0) {
18542  __pyx_t_46 += __pyx_pybuffernd_x.diminfo[0].shape;
18543  if (unlikely(__pyx_t_46 < 0)) __pyx_t_15 = 0;
18544  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18545  if (__pyx_t_47 < 0) {
18546  __pyx_t_47 += __pyx_pybuffernd_x.diminfo[1].shape;
18547  if (unlikely(__pyx_t_47 < 0)) __pyx_t_15 = 1;
18548  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18549  if (__pyx_t_48 < 0) {
18550  __pyx_t_48 += __pyx_pybuffernd_x.diminfo[2].shape;
18551  if (unlikely(__pyx_t_48 < 0)) __pyx_t_15 = 2;
18552  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18553  if (__pyx_t_49 < 0) {
18554  __pyx_t_49 += __pyx_pybuffernd_x.diminfo[3].shape;
18555  if (unlikely(__pyx_t_49 < 0)) __pyx_t_15 = 3;
18556  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18557  if (unlikely(__pyx_t_15 != -1)) {
18558  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18559  __PYX_ERR(0, 841, __pyx_L1_error)
18560  }
18561  __pyx_t_50 = __pyx_v_eN;
18562  __pyx_t_51 = __pyx_v_ebN;
18563  __pyx_t_52 = __pyx_v_k;
18564  __pyx_t_53 = 1;
18565  __pyx_t_15 = -1;
18566  if (__pyx_t_50 < 0) {
18567  __pyx_t_50 += __pyx_pybuffernd_v.diminfo[0].shape;
18568  if (unlikely(__pyx_t_50 < 0)) __pyx_t_15 = 0;
18569  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18570  if (__pyx_t_51 < 0) {
18571  __pyx_t_51 += __pyx_pybuffernd_v.diminfo[1].shape;
18572  if (unlikely(__pyx_t_51 < 0)) __pyx_t_15 = 1;
18573  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18574  if (__pyx_t_52 < 0) {
18575  __pyx_t_52 += __pyx_pybuffernd_v.diminfo[2].shape;
18576  if (unlikely(__pyx_t_52 < 0)) __pyx_t_15 = 2;
18577  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18578  if (__pyx_t_53 < 0) {
18579  __pyx_t_53 += __pyx_pybuffernd_v.diminfo[3].shape;
18580  if (unlikely(__pyx_t_53 < 0)) __pyx_t_15 = 3;
18581  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18582  if (unlikely(__pyx_t_15 != -1)) {
18583  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18584  __PYX_ERR(0, 841, __pyx_L1_error)
18585  }
18586  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_52, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_53, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_48, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_49, __pyx_pybuffernd_x.diminfo[3].strides))));
18587 
18588  /* "subsurfaceTransportFunctions.pyx":842
18589  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18590  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18591  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
18592  * else:
18593  * assert v.shape[v.ndim-1] == 2
18594  */
18595  __pyx_t_54 = __pyx_v_eN;
18596  __pyx_t_55 = __pyx_v_ebN;
18597  __pyx_t_56 = __pyx_v_k;
18598  __pyx_t_57 = 2;
18599  __pyx_t_15 = -1;
18600  if (__pyx_t_54 < 0) {
18601  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[0].shape;
18602  if (unlikely(__pyx_t_54 < 0)) __pyx_t_15 = 0;
18603  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18604  if (__pyx_t_55 < 0) {
18605  __pyx_t_55 += __pyx_pybuffernd_v.diminfo[1].shape;
18606  if (unlikely(__pyx_t_55 < 0)) __pyx_t_15 = 1;
18607  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18608  if (__pyx_t_56 < 0) {
18609  __pyx_t_56 += __pyx_pybuffernd_v.diminfo[2].shape;
18610  if (unlikely(__pyx_t_56 < 0)) __pyx_t_15 = 2;
18611  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18612  if (__pyx_t_57 < 0) {
18613  __pyx_t_57 += __pyx_pybuffernd_v.diminfo[3].shape;
18614  if (unlikely(__pyx_t_57 < 0)) __pyx_t_15 = 3;
18615  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18616  if (unlikely(__pyx_t_15 != -1)) {
18617  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18618  __PYX_ERR(0, 842, __pyx_L1_error)
18619  }
18620  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_57, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
18621  }
18622  }
18623  }
18624  }
18625  __pyx_L4:;
18626 
18627  /* "subsurfaceTransportFunctions.pyx":827
18628  * cdef double pi
18629  * pi = M_PI
18630  * if v.shape[v.ndim-1] == 3: # <<<<<<<<<<<<<<
18631  * if transient == 1:
18632  * for eN in range(x.shape[0]):
18633  */
18634  goto __pyx_L3;
18635  }
18636 
18637  /* "subsurfaceTransportFunctions.pyx":844
18638  * v[eN,ebN,k,2]=zvelocity
18639  * else:
18640  * assert v.shape[v.ndim-1] == 2 # <<<<<<<<<<<<<<
18641  * if transient == 1:
18642  * for eN in range(x.shape[0]):
18643  */
18644  /*else*/ {
18645  #ifndef CYTHON_WITHOUT_ASSERTIONS
18646  if (unlikely(!Py_OptimizeFlag)) {
18647  if (unlikely(!(((__pyx_v_v->dimensions[(__pyx_v_v->nd - 1)]) == 2) != 0))) {
18648  PyErr_SetNone(PyExc_AssertionError);
18649  __PYX_ERR(0, 844, __pyx_L1_error)
18650  }
18651  }
18652  #endif
18653 
18654  /* "subsurfaceTransportFunctions.pyx":845
18655  * else:
18656  * assert v.shape[v.ndim-1] == 2
18657  * if transient == 1: # <<<<<<<<<<<<<<
18658  * for eN in range(x.shape[0]):
18659  * for ebN in range(x.shape[1]):
18660  */
18661  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18662  if (__pyx_t_1) {
18663 
18664  /* "subsurfaceTransportFunctions.pyx":846
18665  * assert v.shape[v.ndim-1] == 2
18666  * if transient == 1:
18667  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18668  * for ebN in range(x.shape[1]):
18669  * for k in range(x.shape[2]):
18670  */
18671  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18672  __pyx_t_3 = __pyx_t_2;
18673  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18674  __pyx_v_eN = __pyx_t_4;
18675 
18676  /* "subsurfaceTransportFunctions.pyx":847
18677  * if transient == 1:
18678  * for eN in range(x.shape[0]):
18679  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18680  * for k in range(x.shape[2]):
18681  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18682  */
18683  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18684  __pyx_t_6 = __pyx_t_5;
18685  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18686  __pyx_v_ebN = __pyx_t_7;
18687 
18688  /* "subsurfaceTransportFunctions.pyx":848
18689  * for eN in range(x.shape[0]):
18690  * for ebN in range(x.shape[1]):
18691  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18692  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18693  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18694  */
18695  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18696  __pyx_t_9 = __pyx_t_8;
18697  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18698  __pyx_v_k = __pyx_t_10;
18699 
18700  /* "subsurfaceTransportFunctions.pyx":849
18701  * for ebN in range(x.shape[1]):
18702  * for k in range(x.shape[2]):
18703  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18704  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18705  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18706  */
18707  __pyx_t_58 = __pyx_v_eN;
18708  __pyx_t_59 = __pyx_v_ebN;
18709  __pyx_t_60 = __pyx_v_k;
18710  __pyx_t_61 = 1;
18711  __pyx_t_15 = -1;
18712  if (__pyx_t_58 < 0) {
18713  __pyx_t_58 += __pyx_pybuffernd_x.diminfo[0].shape;
18714  if (unlikely(__pyx_t_58 < 0)) __pyx_t_15 = 0;
18715  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18716  if (__pyx_t_59 < 0) {
18717  __pyx_t_59 += __pyx_pybuffernd_x.diminfo[1].shape;
18718  if (unlikely(__pyx_t_59 < 0)) __pyx_t_15 = 1;
18719  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18720  if (__pyx_t_60 < 0) {
18721  __pyx_t_60 += __pyx_pybuffernd_x.diminfo[2].shape;
18722  if (unlikely(__pyx_t_60 < 0)) __pyx_t_15 = 2;
18723  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18724  if (__pyx_t_61 < 0) {
18725  __pyx_t_61 += __pyx_pybuffernd_x.diminfo[3].shape;
18726  if (unlikely(__pyx_t_61 < 0)) __pyx_t_15 = 3;
18727  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18728  if (unlikely(__pyx_t_15 != -1)) {
18729  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18730  __PYX_ERR(0, 849, __pyx_L1_error)
18731  }
18732  __pyx_t_62 = __pyx_v_eN;
18733  __pyx_t_63 = __pyx_v_ebN;
18734  __pyx_t_64 = __pyx_v_k;
18735  __pyx_t_65 = 0;
18736  __pyx_t_15 = -1;
18737  if (__pyx_t_62 < 0) {
18738  __pyx_t_62 += __pyx_pybuffernd_v.diminfo[0].shape;
18739  if (unlikely(__pyx_t_62 < 0)) __pyx_t_15 = 0;
18740  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18741  if (__pyx_t_63 < 0) {
18742  __pyx_t_63 += __pyx_pybuffernd_v.diminfo[1].shape;
18743  if (unlikely(__pyx_t_63 < 0)) __pyx_t_15 = 1;
18744  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18745  if (__pyx_t_64 < 0) {
18746  __pyx_t_64 += __pyx_pybuffernd_v.diminfo[2].shape;
18747  if (unlikely(__pyx_t_64 < 0)) __pyx_t_15 = 2;
18748  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18749  if (__pyx_t_65 < 0) {
18750  __pyx_t_65 += __pyx_pybuffernd_v.diminfo[3].shape;
18751  if (unlikely(__pyx_t_65 < 0)) __pyx_t_15 = 3;
18752  } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18753  if (unlikely(__pyx_t_15 != -1)) {
18754  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18755  __PYX_ERR(0, 849, __pyx_L1_error)
18756  }
18757  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_64, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_65, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_60, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_61, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18758 
18759  /* "subsurfaceTransportFunctions.pyx":850
18760  * for k in range(x.shape[2]):
18761  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18762  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18763  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18764  * else:
18765  */
18766  __pyx_t_66 = __pyx_v_eN;
18767  __pyx_t_67 = __pyx_v_ebN;
18768  __pyx_t_68 = __pyx_v_k;
18769  __pyx_t_69 = 0;
18770  __pyx_t_15 = -1;
18771  if (__pyx_t_66 < 0) {
18772  __pyx_t_66 += __pyx_pybuffernd_x.diminfo[0].shape;
18773  if (unlikely(__pyx_t_66 < 0)) __pyx_t_15 = 0;
18774  } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18775  if (__pyx_t_67 < 0) {
18776  __pyx_t_67 += __pyx_pybuffernd_x.diminfo[1].shape;
18777  if (unlikely(__pyx_t_67 < 0)) __pyx_t_15 = 1;
18778  } else if (unlikely(__pyx_t_67 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18779  if (__pyx_t_68 < 0) {
18780  __pyx_t_68 += __pyx_pybuffernd_x.diminfo[2].shape;
18781  if (unlikely(__pyx_t_68 < 0)) __pyx_t_15 = 2;
18782  } else if (unlikely(__pyx_t_68 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18783  if (__pyx_t_69 < 0) {
18784  __pyx_t_69 += __pyx_pybuffernd_x.diminfo[3].shape;
18785  if (unlikely(__pyx_t_69 < 0)) __pyx_t_15 = 3;
18786  } else if (unlikely(__pyx_t_69 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18787  if (unlikely(__pyx_t_15 != -1)) {
18788  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18789  __PYX_ERR(0, 850, __pyx_L1_error)
18790  }
18791  __pyx_t_70 = __pyx_v_eN;
18792  __pyx_t_71 = __pyx_v_ebN;
18793  __pyx_t_72 = __pyx_v_k;
18794  __pyx_t_73 = 1;
18795  __pyx_t_15 = -1;
18796  if (__pyx_t_70 < 0) {
18797  __pyx_t_70 += __pyx_pybuffernd_v.diminfo[0].shape;
18798  if (unlikely(__pyx_t_70 < 0)) __pyx_t_15 = 0;
18799  } else if (unlikely(__pyx_t_70 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18800  if (__pyx_t_71 < 0) {
18801  __pyx_t_71 += __pyx_pybuffernd_v.diminfo[1].shape;
18802  if (unlikely(__pyx_t_71 < 0)) __pyx_t_15 = 1;
18803  } else if (unlikely(__pyx_t_71 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18804  if (__pyx_t_72 < 0) {
18805  __pyx_t_72 += __pyx_pybuffernd_v.diminfo[2].shape;
18806  if (unlikely(__pyx_t_72 < 0)) __pyx_t_15 = 2;
18807  } else if (unlikely(__pyx_t_72 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18808  if (__pyx_t_73 < 0) {
18809  __pyx_t_73 += __pyx_pybuffernd_v.diminfo[3].shape;
18810  if (unlikely(__pyx_t_73 < 0)) __pyx_t_15 = 3;
18811  } else if (unlikely(__pyx_t_73 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18812  if (unlikely(__pyx_t_15 != -1)) {
18813  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18814  __PYX_ERR(0, 850, __pyx_L1_error)
18815  }
18816  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_71, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_72, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_73, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_68, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_69, __pyx_pybuffernd_x.diminfo[3].strides))));
18817 
18818  /* "subsurfaceTransportFunctions.pyx":851
18819  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18820  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18821  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
18822  * else:
18823  * for eN in range(x.shape[0]):
18824  */
18825  __pyx_t_35 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 851, __pyx_L1_error)
18826  __Pyx_GOTREF(__pyx_t_35);
18827  __pyx_t_32 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 851, __pyx_L1_error)
18828  __Pyx_GOTREF(__pyx_t_32);
18829  __pyx_t_33 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 851, __pyx_L1_error)
18830  __Pyx_GOTREF(__pyx_t_33);
18831  __pyx_t_34 = PyTuple_New(4); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 851, __pyx_L1_error)
18832  __Pyx_GOTREF(__pyx_t_34);
18833  __Pyx_GIVEREF(__pyx_t_35);
18834  PyTuple_SET_ITEM(__pyx_t_34, 0, __pyx_t_35);
18835  __Pyx_GIVEREF(__pyx_t_32);
18836  PyTuple_SET_ITEM(__pyx_t_34, 1, __pyx_t_32);
18837  __Pyx_GIVEREF(__pyx_t_33);
18838  PyTuple_SET_ITEM(__pyx_t_34, 2, __pyx_t_33);
18839  __Pyx_INCREF(__pyx_slice__6);
18840  __Pyx_GIVEREF(__pyx_slice__6);
18841  PyTuple_SET_ITEM(__pyx_t_34, 3, __pyx_slice__6);
18842  __pyx_t_35 = 0;
18843  __pyx_t_32 = 0;
18844  __pyx_t_33 = 0;
18845  __pyx_t_33 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_34); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 851, __pyx_L1_error)
18846  __Pyx_GOTREF(__pyx_t_33);
18847  __pyx_t_37 = (__pyx_v_tForReversal - __pyx_v_t);
18848  __pyx_t_36 = (__pyx_v_tForReversal - 0.0);
18849  if (unlikely(__pyx_t_36 == 0)) {
18850  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18851  __PYX_ERR(0, 851, __pyx_L1_error)
18852  }
18853  __pyx_t_32 = PyFloat_FromDouble(((__pyx_t_37 / __pyx_t_36) * __pyx_v_clock)); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 851, __pyx_L1_error)
18854  __Pyx_GOTREF(__pyx_t_32);
18855  __pyx_t_35 = PyNumber_InPlaceMultiply(__pyx_t_33, __pyx_t_32); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 851, __pyx_L1_error)
18856  __Pyx_GOTREF(__pyx_t_35);
18857  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
18858  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
18859  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_34, __pyx_t_35) < 0)) __PYX_ERR(0, 851, __pyx_L1_error)
18860  __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
18861  __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
18862  }
18863  }
18864  }
18865 
18866  /* "subsurfaceTransportFunctions.pyx":845
18867  * else:
18868  * assert v.shape[v.ndim-1] == 2
18869  * if transient == 1: # <<<<<<<<<<<<<<
18870  * for eN in range(x.shape[0]):
18871  * for ebN in range(x.shape[1]):
18872  */
18873  goto __pyx_L17;
18874  }
18875 
18876  /* "subsurfaceTransportFunctions.pyx":853
18877  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18878  * else:
18879  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18880  * for ebN in range(x.shape[1]):
18881  * for k in range(x.shape[2]):
18882  */
18883  /*else*/ {
18884  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18885  __pyx_t_3 = __pyx_t_2;
18886  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18887  __pyx_v_eN = __pyx_t_4;
18888 
18889  /* "subsurfaceTransportFunctions.pyx":854
18890  * else:
18891  * for eN in range(x.shape[0]):
18892  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18893  * for k in range(x.shape[2]):
18894  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18895  */
18896  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18897  __pyx_t_6 = __pyx_t_5;
18898  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18899  __pyx_v_ebN = __pyx_t_7;
18900 
18901  /* "subsurfaceTransportFunctions.pyx":855
18902  * for eN in range(x.shape[0]):
18903  * for ebN in range(x.shape[1]):
18904  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18905  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18906  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18907  */
18908  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18909  __pyx_t_9 = __pyx_t_8;
18910  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18911  __pyx_v_k = __pyx_t_10;
18912 
18913  /* "subsurfaceTransportFunctions.pyx":856
18914  * for ebN in range(x.shape[1]):
18915  * for k in range(x.shape[2]):
18916  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18917  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18918  *
18919  */
18920  __pyx_t_74 = __pyx_v_eN;
18921  __pyx_t_75 = __pyx_v_ebN;
18922  __pyx_t_76 = __pyx_v_k;
18923  __pyx_t_77 = 1;
18924  __pyx_t_15 = -1;
18925  if (__pyx_t_74 < 0) {
18926  __pyx_t_74 += __pyx_pybuffernd_x.diminfo[0].shape;
18927  if (unlikely(__pyx_t_74 < 0)) __pyx_t_15 = 0;
18928  } else if (unlikely(__pyx_t_74 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18929  if (__pyx_t_75 < 0) {
18930  __pyx_t_75 += __pyx_pybuffernd_x.diminfo[1].shape;
18931  if (unlikely(__pyx_t_75 < 0)) __pyx_t_15 = 1;
18932  } else if (unlikely(__pyx_t_75 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18933  if (__pyx_t_76 < 0) {
18934  __pyx_t_76 += __pyx_pybuffernd_x.diminfo[2].shape;
18935  if (unlikely(__pyx_t_76 < 0)) __pyx_t_15 = 2;
18936  } else if (unlikely(__pyx_t_76 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18937  if (__pyx_t_77 < 0) {
18938  __pyx_t_77 += __pyx_pybuffernd_x.diminfo[3].shape;
18939  if (unlikely(__pyx_t_77 < 0)) __pyx_t_15 = 3;
18940  } else if (unlikely(__pyx_t_77 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18941  if (unlikely(__pyx_t_15 != -1)) {
18942  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18943  __PYX_ERR(0, 856, __pyx_L1_error)
18944  }
18945  __pyx_t_78 = __pyx_v_eN;
18946  __pyx_t_79 = __pyx_v_ebN;
18947  __pyx_t_80 = __pyx_v_k;
18948  __pyx_t_81 = 0;
18949  __pyx_t_15 = -1;
18950  if (__pyx_t_78 < 0) {
18951  __pyx_t_78 += __pyx_pybuffernd_v.diminfo[0].shape;
18952  if (unlikely(__pyx_t_78 < 0)) __pyx_t_15 = 0;
18953  } else if (unlikely(__pyx_t_78 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18954  if (__pyx_t_79 < 0) {
18955  __pyx_t_79 += __pyx_pybuffernd_v.diminfo[1].shape;
18956  if (unlikely(__pyx_t_79 < 0)) __pyx_t_15 = 1;
18957  } else if (unlikely(__pyx_t_79 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18958  if (__pyx_t_80 < 0) {
18959  __pyx_t_80 += __pyx_pybuffernd_v.diminfo[2].shape;
18960  if (unlikely(__pyx_t_80 < 0)) __pyx_t_15 = 2;
18961  } else if (unlikely(__pyx_t_80 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18962  if (__pyx_t_81 < 0) {
18963  __pyx_t_81 += __pyx_pybuffernd_v.diminfo[3].shape;
18964  if (unlikely(__pyx_t_81 < 0)) __pyx_t_15 = 3;
18965  } else if (unlikely(__pyx_t_81 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18966  if (unlikely(__pyx_t_15 != -1)) {
18967  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18968  __PYX_ERR(0, 856, __pyx_L1_error)
18969  }
18970  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_78, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_79, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_80, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_81, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_75, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_76, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_77, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18971 
18972  /* "subsurfaceTransportFunctions.pyx":857
18973  * for k in range(x.shape[2]):
18974  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18975  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18976  *
18977  * def helicalElementVelocityEval3(int transient,
18978  */
18979  __pyx_t_82 = __pyx_v_eN;
18980  __pyx_t_83 = __pyx_v_ebN;
18981  __pyx_t_84 = __pyx_v_k;
18982  __pyx_t_85 = 0;
18983  __pyx_t_15 = -1;
18984  if (__pyx_t_82 < 0) {
18985  __pyx_t_82 += __pyx_pybuffernd_x.diminfo[0].shape;
18986  if (unlikely(__pyx_t_82 < 0)) __pyx_t_15 = 0;
18987  } else if (unlikely(__pyx_t_82 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18988  if (__pyx_t_83 < 0) {
18989  __pyx_t_83 += __pyx_pybuffernd_x.diminfo[1].shape;
18990  if (unlikely(__pyx_t_83 < 0)) __pyx_t_15 = 1;
18991  } else if (unlikely(__pyx_t_83 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18992  if (__pyx_t_84 < 0) {
18993  __pyx_t_84 += __pyx_pybuffernd_x.diminfo[2].shape;
18994  if (unlikely(__pyx_t_84 < 0)) __pyx_t_15 = 2;
18995  } else if (unlikely(__pyx_t_84 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18996  if (__pyx_t_85 < 0) {
18997  __pyx_t_85 += __pyx_pybuffernd_x.diminfo[3].shape;
18998  if (unlikely(__pyx_t_85 < 0)) __pyx_t_15 = 3;
18999  } else if (unlikely(__pyx_t_85 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
19000  if (unlikely(__pyx_t_15 != -1)) {
19001  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19002  __PYX_ERR(0, 857, __pyx_L1_error)
19003  }
19004  __pyx_t_86 = __pyx_v_eN;
19005  __pyx_t_87 = __pyx_v_ebN;
19006  __pyx_t_88 = __pyx_v_k;
19007  __pyx_t_89 = 1;
19008  __pyx_t_15 = -1;
19009  if (__pyx_t_86 < 0) {
19010  __pyx_t_86 += __pyx_pybuffernd_v.diminfo[0].shape;
19011  if (unlikely(__pyx_t_86 < 0)) __pyx_t_15 = 0;
19012  } else if (unlikely(__pyx_t_86 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
19013  if (__pyx_t_87 < 0) {
19014  __pyx_t_87 += __pyx_pybuffernd_v.diminfo[1].shape;
19015  if (unlikely(__pyx_t_87 < 0)) __pyx_t_15 = 1;
19016  } else if (unlikely(__pyx_t_87 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
19017  if (__pyx_t_88 < 0) {
19018  __pyx_t_88 += __pyx_pybuffernd_v.diminfo[2].shape;
19019  if (unlikely(__pyx_t_88 < 0)) __pyx_t_15 = 2;
19020  } else if (unlikely(__pyx_t_88 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
19021  if (__pyx_t_89 < 0) {
19022  __pyx_t_89 += __pyx_pybuffernd_v.diminfo[3].shape;
19023  if (unlikely(__pyx_t_89 < 0)) __pyx_t_15 = 3;
19024  } else if (unlikely(__pyx_t_89 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
19025  if (unlikely(__pyx_t_15 != -1)) {
19026  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19027  __PYX_ERR(0, 857, __pyx_L1_error)
19028  }
19029  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_86, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_87, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_88, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_89, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_83, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_84, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_85, __pyx_pybuffernd_x.diminfo[3].strides))));
19030  }
19031  }
19032  }
19033  }
19034  __pyx_L17:;
19035  }
19036  __pyx_L3:;
19037 
19038  /* "subsurfaceTransportFunctions.pyx":816
19039  *
19040  *
19041  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
19042  * double t,
19043  * double tForReversal,
19044  */
19045 
19046  /* function exit code */
19047  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19048  goto __pyx_L0;
19049  __pyx_L1_error:;
19050  __Pyx_XDECREF(__pyx_t_32);
19051  __Pyx_XDECREF(__pyx_t_33);
19052  __Pyx_XDECREF(__pyx_t_34);
19053  __Pyx_XDECREF(__pyx_t_35);
19054  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
19055  __Pyx_PyThreadState_declare
19056  __Pyx_PyThreadState_assign
19057  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
19058  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19059  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19060  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
19061  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
19062  __pyx_r = NULL;
19063  goto __pyx_L2;
19064  __pyx_L0:;
19065  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19066  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19067  __pyx_L2:;
19068  __Pyx_XGIVEREF(__pyx_r);
19069  __Pyx_RefNannyFinishContext();
19070  return __pyx_r;
19071 }
19072 
19073 /* "subsurfaceTransportFunctions.pyx":859
19074  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19075  *
19076  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
19077  * double t,
19078  * double tForReversal,
19079  */
19080 
19081 /* Python wrapper */
19082 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19083 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3 = {"helicalElementVelocityEval3", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
19084 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19085  int __pyx_v_transient;
19086  double __pyx_v_t;
19087  double __pyx_v_tForReversal;
19088  double __pyx_v_clock;
19089  double __pyx_v_zVelocity;
19090  double __pyx_v_xc;
19091  double __pyx_v_yc;
19092  PyArrayObject *__pyx_v_x = 0;
19093  PyArrayObject *__pyx_v_v = 0;
19094  PyObject *__pyx_r = 0;
19095  __Pyx_RefNannyDeclarations
19096  __Pyx_RefNannySetupContext("helicalElementVelocityEval3 (wrapper)", 0);
19097  {
19098  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
19099  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
19100  if (unlikely(__pyx_kwds)) {
19101  Py_ssize_t kw_args;
19102  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19103  switch (pos_args) {
19104  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19105  CYTHON_FALLTHROUGH;
19106  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19107  CYTHON_FALLTHROUGH;
19108  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19109  CYTHON_FALLTHROUGH;
19110  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19111  CYTHON_FALLTHROUGH;
19112  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19113  CYTHON_FALLTHROUGH;
19114  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19115  CYTHON_FALLTHROUGH;
19116  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19117  CYTHON_FALLTHROUGH;
19118  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19119  CYTHON_FALLTHROUGH;
19120  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19121  CYTHON_FALLTHROUGH;
19122  case 0: break;
19123  default: goto __pyx_L5_argtuple_error;
19124  }
19125  kw_args = PyDict_Size(__pyx_kwds);
19126  switch (pos_args) {
19127  case 0:
19128  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
19129  else goto __pyx_L5_argtuple_error;
19130  CYTHON_FALLTHROUGH;
19131  case 1:
19132  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
19133  else {
19134  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 1); __PYX_ERR(0, 859, __pyx_L3_error)
19135  }
19136  CYTHON_FALLTHROUGH;
19137  case 2:
19138  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
19139  else {
19140  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 2); __PYX_ERR(0, 859, __pyx_L3_error)
19141  }
19142  CYTHON_FALLTHROUGH;
19143  case 3:
19144  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
19145  else {
19146  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 3); __PYX_ERR(0, 859, __pyx_L3_error)
19147  }
19148  CYTHON_FALLTHROUGH;
19149  case 4:
19150  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
19151  else {
19152  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 4); __PYX_ERR(0, 859, __pyx_L3_error)
19153  }
19154  CYTHON_FALLTHROUGH;
19155  case 5:
19156  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
19157  else {
19158  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 5); __PYX_ERR(0, 859, __pyx_L3_error)
19159  }
19160  CYTHON_FALLTHROUGH;
19161  case 6:
19162  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
19163  else {
19164  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 6); __PYX_ERR(0, 859, __pyx_L3_error)
19165  }
19166  CYTHON_FALLTHROUGH;
19167  case 7:
19168  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
19169  else {
19170  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 7); __PYX_ERR(0, 859, __pyx_L3_error)
19171  }
19172  CYTHON_FALLTHROUGH;
19173  case 8:
19174  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
19175  else {
19176  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 8); __PYX_ERR(0, 859, __pyx_L3_error)
19177  }
19178  }
19179  if (unlikely(kw_args > 0)) {
19180  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval3") < 0)) __PYX_ERR(0, 859, __pyx_L3_error)
19181  }
19182  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
19183  goto __pyx_L5_argtuple_error;
19184  } else {
19185  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19186  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19187  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19188  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19189  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19190  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19191  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19192  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19193  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19194  }
19195  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L3_error)
19196  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 860, __pyx_L3_error)
19197  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 861, __pyx_L3_error)
19198  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 862, __pyx_L3_error)
19199  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 863, __pyx_L3_error)
19200  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
19201  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
19202  __pyx_v_x = ((PyArrayObject *)values[7]);
19203  __pyx_v_v = ((PyArrayObject *)values[8]);
19204  }
19205  goto __pyx_L4_argument_unpacking_done;
19206  __pyx_L5_argtuple_error:;
19207  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 859, __pyx_L3_error)
19208  __pyx_L3_error:;
19209  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19210  __Pyx_RefNannyFinishContext();
19211  return NULL;
19212  __pyx_L4_argument_unpacking_done:;
19213  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 865, __pyx_L1_error)
19214  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 866, __pyx_L1_error)
19215  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
19216 
19217  /* function exit code */
19218  goto __pyx_L0;
19219  __pyx_L1_error:;
19220  __pyx_r = NULL;
19221  __pyx_L0:;
19222  __Pyx_RefNannyFinishContext();
19223  return __pyx_r;
19224 }
19225 
19226 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19227  int __pyx_v_eN;
19228  int __pyx_v_k;
19229  double __pyx_v_pi;
19230  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19231  __Pyx_Buffer __pyx_pybuffer_v;
19232  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19233  __Pyx_Buffer __pyx_pybuffer_x;
19234  PyObject *__pyx_r = NULL;
19235  __Pyx_RefNannyDeclarations
19236  int __pyx_t_1;
19237  npy_intp __pyx_t_2;
19238  npy_intp __pyx_t_3;
19239  int __pyx_t_4;
19240  npy_intp __pyx_t_5;
19241  npy_intp __pyx_t_6;
19242  int __pyx_t_7;
19243  Py_ssize_t __pyx_t_8;
19244  Py_ssize_t __pyx_t_9;
19245  Py_ssize_t __pyx_t_10;
19246  int __pyx_t_11;
19247  Py_ssize_t __pyx_t_12;
19248  Py_ssize_t __pyx_t_13;
19249  Py_ssize_t __pyx_t_14;
19250  Py_ssize_t __pyx_t_15;
19251  Py_ssize_t __pyx_t_16;
19252  Py_ssize_t __pyx_t_17;
19253  Py_ssize_t __pyx_t_18;
19254  Py_ssize_t __pyx_t_19;
19255  Py_ssize_t __pyx_t_20;
19256  Py_ssize_t __pyx_t_21;
19257  Py_ssize_t __pyx_t_22;
19258  Py_ssize_t __pyx_t_23;
19259  PyObject *__pyx_t_24 = NULL;
19260  PyObject *__pyx_t_25 = NULL;
19261  PyObject *__pyx_t_26 = NULL;
19262  double __pyx_t_27;
19263  double __pyx_t_28;
19264  PyObject *__pyx_t_29 = NULL;
19265  Py_ssize_t __pyx_t_30;
19266  Py_ssize_t __pyx_t_31;
19267  Py_ssize_t __pyx_t_32;
19268  Py_ssize_t __pyx_t_33;
19269  Py_ssize_t __pyx_t_34;
19270  Py_ssize_t __pyx_t_35;
19271  Py_ssize_t __pyx_t_36;
19272  Py_ssize_t __pyx_t_37;
19273  Py_ssize_t __pyx_t_38;
19274  Py_ssize_t __pyx_t_39;
19275  Py_ssize_t __pyx_t_40;
19276  Py_ssize_t __pyx_t_41;
19277  Py_ssize_t __pyx_t_42;
19278  Py_ssize_t __pyx_t_43;
19279  Py_ssize_t __pyx_t_44;
19280  __Pyx_RefNannySetupContext("helicalElementVelocityEval3", 0);
19281  __pyx_pybuffer_x.pybuffer.buf = NULL;
19282  __pyx_pybuffer_x.refcount = 0;
19283  __pyx_pybuffernd_x.data = NULL;
19284  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19285  __pyx_pybuffer_v.pybuffer.buf = NULL;
19286  __pyx_pybuffer_v.refcount = 0;
19287  __pyx_pybuffernd_v.data = NULL;
19288  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19289  {
19290  __Pyx_BufFmt_StackElem __pyx_stack[1];
19291  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 859, __pyx_L1_error)
19292  }
19293  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
19294  {
19295  __Pyx_BufFmt_StackElem __pyx_stack[1];
19296  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 859, __pyx_L1_error)
19297  }
19298  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
19299 
19300  /* "subsurfaceTransportFunctions.pyx":869
19301  * cdef int eN,k
19302  * cdef double pi
19303  * pi = M_PI # <<<<<<<<<<<<<<
19304  * if transient == 1:
19305  * for eN in range(x.shape[0]):
19306  */
19307  __pyx_v_pi = M_PI;
19308 
19309  /* "subsurfaceTransportFunctions.pyx":870
19310  * cdef double pi
19311  * pi = M_PI
19312  * if transient == 1: # <<<<<<<<<<<<<<
19313  * for eN in range(x.shape[0]):
19314  * for k in range(x.shape[1]):
19315  */
19316  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
19317  if (__pyx_t_1) {
19318 
19319  /* "subsurfaceTransportFunctions.pyx":871
19320  * pi = M_PI
19321  * if transient == 1:
19322  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19323  * for k in range(x.shape[1]):
19324  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19325  */
19326  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19327  __pyx_t_3 = __pyx_t_2;
19328  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19329  __pyx_v_eN = __pyx_t_4;
19330 
19331  /* "subsurfaceTransportFunctions.pyx":872
19332  * if transient == 1:
19333  * for eN in range(x.shape[0]):
19334  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19335  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19336  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19337  */
19338  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19339  __pyx_t_6 = __pyx_t_5;
19340  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19341  __pyx_v_k = __pyx_t_7;
19342 
19343  /* "subsurfaceTransportFunctions.pyx":873
19344  * for eN in range(x.shape[0]):
19345  * for k in range(x.shape[1]):
19346  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
19347  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19348  * v[eN,k,2]=zVelocity
19349  */
19350  __pyx_t_8 = __pyx_v_eN;
19351  __pyx_t_9 = __pyx_v_k;
19352  __pyx_t_10 = 1;
19353  __pyx_t_11 = -1;
19354  if (__pyx_t_8 < 0) {
19355  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
19356  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
19357  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19358  if (__pyx_t_9 < 0) {
19359  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19360  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19361  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19362  if (__pyx_t_10 < 0) {
19363  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
19364  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
19365  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19366  if (unlikely(__pyx_t_11 != -1)) {
19367  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19368  __PYX_ERR(0, 873, __pyx_L1_error)
19369  }
19370  __pyx_t_12 = __pyx_v_eN;
19371  __pyx_t_13 = __pyx_v_k;
19372  __pyx_t_14 = 0;
19373  __pyx_t_11 = -1;
19374  if (__pyx_t_12 < 0) {
19375  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
19376  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
19377  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19378  if (__pyx_t_13 < 0) {
19379  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19380  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19381  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19382  if (__pyx_t_14 < 0) {
19383  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
19384  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
19385  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19386  if (unlikely(__pyx_t_11 != -1)) {
19387  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19388  __PYX_ERR(0, 873, __pyx_L1_error)
19389  }
19390  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
19391 
19392  /* "subsurfaceTransportFunctions.pyx":874
19393  * for k in range(x.shape[1]):
19394  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19395  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
19396  * v[eN,k,2]=zVelocity
19397  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19398  */
19399  __pyx_t_15 = __pyx_v_eN;
19400  __pyx_t_16 = __pyx_v_k;
19401  __pyx_t_17 = 0;
19402  __pyx_t_11 = -1;
19403  if (__pyx_t_15 < 0) {
19404  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[0].shape;
19405  if (unlikely(__pyx_t_15 < 0)) __pyx_t_11 = 0;
19406  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19407  if (__pyx_t_16 < 0) {
19408  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[1].shape;
19409  if (unlikely(__pyx_t_16 < 0)) __pyx_t_11 = 1;
19410  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19411  if (__pyx_t_17 < 0) {
19412  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[2].shape;
19413  if (unlikely(__pyx_t_17 < 0)) __pyx_t_11 = 2;
19414  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19415  if (unlikely(__pyx_t_11 != -1)) {
19416  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19417  __PYX_ERR(0, 874, __pyx_L1_error)
19418  }
19419  __pyx_t_18 = __pyx_v_eN;
19420  __pyx_t_19 = __pyx_v_k;
19421  __pyx_t_20 = 1;
19422  __pyx_t_11 = -1;
19423  if (__pyx_t_18 < 0) {
19424  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[0].shape;
19425  if (unlikely(__pyx_t_18 < 0)) __pyx_t_11 = 0;
19426  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19427  if (__pyx_t_19 < 0) {
19428  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[1].shape;
19429  if (unlikely(__pyx_t_19 < 0)) __pyx_t_11 = 1;
19430  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19431  if (__pyx_t_20 < 0) {
19432  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[2].shape;
19433  if (unlikely(__pyx_t_20 < 0)) __pyx_t_11 = 2;
19434  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19435  if (unlikely(__pyx_t_11 != -1)) {
19436  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19437  __PYX_ERR(0, 874, __pyx_L1_error)
19438  }
19439  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[2].strides))));
19440 
19441  /* "subsurfaceTransportFunctions.pyx":875
19442  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19443  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19444  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
19445  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19446  * else:
19447  */
19448  __pyx_t_21 = __pyx_v_eN;
19449  __pyx_t_22 = __pyx_v_k;
19450  __pyx_t_23 = 2;
19451  __pyx_t_11 = -1;
19452  if (__pyx_t_21 < 0) {
19453  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[0].shape;
19454  if (unlikely(__pyx_t_21 < 0)) __pyx_t_11 = 0;
19455  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19456  if (__pyx_t_22 < 0) {
19457  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[1].shape;
19458  if (unlikely(__pyx_t_22 < 0)) __pyx_t_11 = 1;
19459  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19460  if (__pyx_t_23 < 0) {
19461  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[2].shape;
19462  if (unlikely(__pyx_t_23 < 0)) __pyx_t_11 = 2;
19463  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19464  if (unlikely(__pyx_t_11 != -1)) {
19465  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19466  __PYX_ERR(0, 875, __pyx_L1_error)
19467  }
19468  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
19469 
19470  /* "subsurfaceTransportFunctions.pyx":876
19471  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19472  * v[eN,k,2]=zVelocity
19473  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
19474  * else:
19475  * for eN in range(x.shape[0]):
19476  */
19477  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 876, __pyx_L1_error)
19478  __Pyx_GOTREF(__pyx_t_24);
19479  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 876, __pyx_L1_error)
19480  __Pyx_GOTREF(__pyx_t_25);
19481  __pyx_t_26 = PyTuple_New(3); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 876, __pyx_L1_error)
19482  __Pyx_GOTREF(__pyx_t_26);
19483  __Pyx_GIVEREF(__pyx_t_24);
19484  PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_24);
19485  __Pyx_GIVEREF(__pyx_t_25);
19486  PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_25);
19487  __Pyx_INCREF(__pyx_slice__7);
19488  __Pyx_GIVEREF(__pyx_slice__7);
19489  PyTuple_SET_ITEM(__pyx_t_26, 2, __pyx_slice__7);
19490  __pyx_t_24 = 0;
19491  __pyx_t_25 = 0;
19492  __pyx_t_25 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_26); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 876, __pyx_L1_error)
19493  __Pyx_GOTREF(__pyx_t_25);
19494  __pyx_t_27 = (__pyx_v_pi * __pyx_v_t);
19495  __pyx_t_28 = (__pyx_v_tForReversal * 2.0);
19496  if (unlikely(__pyx_t_28 == 0)) {
19497  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
19498  __PYX_ERR(0, 876, __pyx_L1_error)
19499  }
19500  __pyx_t_24 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_27 / __pyx_t_28)))); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 876, __pyx_L1_error)
19501  __Pyx_GOTREF(__pyx_t_24);
19502  __pyx_t_29 = PyNumber_InPlaceMultiply(__pyx_t_25, __pyx_t_24); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 876, __pyx_L1_error)
19503  __Pyx_GOTREF(__pyx_t_29);
19504  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
19505  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
19506  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_26, __pyx_t_29) < 0)) __PYX_ERR(0, 876, __pyx_L1_error)
19507  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
19508  __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
19509  }
19510  }
19511 
19512  /* "subsurfaceTransportFunctions.pyx":870
19513  * cdef double pi
19514  * pi = M_PI
19515  * if transient == 1: # <<<<<<<<<<<<<<
19516  * for eN in range(x.shape[0]):
19517  * for k in range(x.shape[1]):
19518  */
19519  goto __pyx_L3;
19520  }
19521 
19522  /* "subsurfaceTransportFunctions.pyx":878
19523  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19524  * else:
19525  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19526  * for k in range(x.shape[1]):
19527  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19528  */
19529  /*else*/ {
19530  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19531  __pyx_t_3 = __pyx_t_2;
19532  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19533  __pyx_v_eN = __pyx_t_4;
19534 
19535  /* "subsurfaceTransportFunctions.pyx":879
19536  * else:
19537  * for eN in range(x.shape[0]):
19538  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19539  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19540  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19541  */
19542  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19543  __pyx_t_6 = __pyx_t_5;
19544  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19545  __pyx_v_k = __pyx_t_7;
19546 
19547  /* "subsurfaceTransportFunctions.pyx":880
19548  * for eN in range(x.shape[0]):
19549  * for k in range(x.shape[1]):
19550  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
19551  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19552  * v[eN,k,2]=zVelocity
19553  */
19554  __pyx_t_30 = __pyx_v_eN;
19555  __pyx_t_31 = __pyx_v_k;
19556  __pyx_t_32 = 1;
19557  __pyx_t_11 = -1;
19558  if (__pyx_t_30 < 0) {
19559  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[0].shape;
19560  if (unlikely(__pyx_t_30 < 0)) __pyx_t_11 = 0;
19561  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19562  if (__pyx_t_31 < 0) {
19563  __pyx_t_31 += __pyx_pybuffernd_x.diminfo[1].shape;
19564  if (unlikely(__pyx_t_31 < 0)) __pyx_t_11 = 1;
19565  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19566  if (__pyx_t_32 < 0) {
19567  __pyx_t_32 += __pyx_pybuffernd_x.diminfo[2].shape;
19568  if (unlikely(__pyx_t_32 < 0)) __pyx_t_11 = 2;
19569  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19570  if (unlikely(__pyx_t_11 != -1)) {
19571  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19572  __PYX_ERR(0, 880, __pyx_L1_error)
19573  }
19574  __pyx_t_33 = __pyx_v_eN;
19575  __pyx_t_34 = __pyx_v_k;
19576  __pyx_t_35 = 0;
19577  __pyx_t_11 = -1;
19578  if (__pyx_t_33 < 0) {
19579  __pyx_t_33 += __pyx_pybuffernd_v.diminfo[0].shape;
19580  if (unlikely(__pyx_t_33 < 0)) __pyx_t_11 = 0;
19581  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19582  if (__pyx_t_34 < 0) {
19583  __pyx_t_34 += __pyx_pybuffernd_v.diminfo[1].shape;
19584  if (unlikely(__pyx_t_34 < 0)) __pyx_t_11 = 1;
19585  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19586  if (__pyx_t_35 < 0) {
19587  __pyx_t_35 += __pyx_pybuffernd_v.diminfo[2].shape;
19588  if (unlikely(__pyx_t_35 < 0)) __pyx_t_11 = 2;
19589  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19590  if (unlikely(__pyx_t_11 != -1)) {
19591  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19592  __PYX_ERR(0, 880, __pyx_L1_error)
19593  }
19594  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_35, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_32, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
19595 
19596  /* "subsurfaceTransportFunctions.pyx":881
19597  * for k in range(x.shape[1]):
19598  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19599  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
19600  * v[eN,k,2]=zVelocity
19601  *
19602  */
19603  __pyx_t_36 = __pyx_v_eN;
19604  __pyx_t_37 = __pyx_v_k;
19605  __pyx_t_38 = 0;
19606  __pyx_t_11 = -1;
19607  if (__pyx_t_36 < 0) {
19608  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[0].shape;
19609  if (unlikely(__pyx_t_36 < 0)) __pyx_t_11 = 0;
19610  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19611  if (__pyx_t_37 < 0) {
19612  __pyx_t_37 += __pyx_pybuffernd_x.diminfo[1].shape;
19613  if (unlikely(__pyx_t_37 < 0)) __pyx_t_11 = 1;
19614  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19615  if (__pyx_t_38 < 0) {
19616  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[2].shape;
19617  if (unlikely(__pyx_t_38 < 0)) __pyx_t_11 = 2;
19618  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19619  if (unlikely(__pyx_t_11 != -1)) {
19620  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19621  __PYX_ERR(0, 881, __pyx_L1_error)
19622  }
19623  __pyx_t_39 = __pyx_v_eN;
19624  __pyx_t_40 = __pyx_v_k;
19625  __pyx_t_41 = 1;
19626  __pyx_t_11 = -1;
19627  if (__pyx_t_39 < 0) {
19628  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[0].shape;
19629  if (unlikely(__pyx_t_39 < 0)) __pyx_t_11 = 0;
19630  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19631  if (__pyx_t_40 < 0) {
19632  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[1].shape;
19633  if (unlikely(__pyx_t_40 < 0)) __pyx_t_11 = 1;
19634  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19635  if (__pyx_t_41 < 0) {
19636  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[2].shape;
19637  if (unlikely(__pyx_t_41 < 0)) __pyx_t_11 = 2;
19638  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19639  if (unlikely(__pyx_t_11 != -1)) {
19640  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19641  __PYX_ERR(0, 881, __pyx_L1_error)
19642  }
19643  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_38, __pyx_pybuffernd_x.diminfo[2].strides))));
19644 
19645  /* "subsurfaceTransportFunctions.pyx":882
19646  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19647  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19648  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
19649  *
19650  * def helicalElementVelocityEval4(int transient,
19651  */
19652  __pyx_t_42 = __pyx_v_eN;
19653  __pyx_t_43 = __pyx_v_k;
19654  __pyx_t_44 = 2;
19655  __pyx_t_11 = -1;
19656  if (__pyx_t_42 < 0) {
19657  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[0].shape;
19658  if (unlikely(__pyx_t_42 < 0)) __pyx_t_11 = 0;
19659  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19660  if (__pyx_t_43 < 0) {
19661  __pyx_t_43 += __pyx_pybuffernd_v.diminfo[1].shape;
19662  if (unlikely(__pyx_t_43 < 0)) __pyx_t_11 = 1;
19663  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19664  if (__pyx_t_44 < 0) {
19665  __pyx_t_44 += __pyx_pybuffernd_v.diminfo[2].shape;
19666  if (unlikely(__pyx_t_44 < 0)) __pyx_t_11 = 2;
19667  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19668  if (unlikely(__pyx_t_11 != -1)) {
19669  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19670  __PYX_ERR(0, 882, __pyx_L1_error)
19671  }
19672  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
19673  }
19674  }
19675  }
19676  __pyx_L3:;
19677 
19678  /* "subsurfaceTransportFunctions.pyx":859
19679  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19680  *
19681  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
19682  * double t,
19683  * double tForReversal,
19684  */
19685 
19686  /* function exit code */
19687  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19688  goto __pyx_L0;
19689  __pyx_L1_error:;
19690  __Pyx_XDECREF(__pyx_t_24);
19691  __Pyx_XDECREF(__pyx_t_25);
19692  __Pyx_XDECREF(__pyx_t_26);
19693  __Pyx_XDECREF(__pyx_t_29);
19694  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
19695  __Pyx_PyThreadState_declare
19696  __Pyx_PyThreadState_assign
19697  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
19698  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19699  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19700  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
19701  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19702  __pyx_r = NULL;
19703  goto __pyx_L2;
19704  __pyx_L0:;
19705  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19706  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19707  __pyx_L2:;
19708  __Pyx_XGIVEREF(__pyx_r);
19709  __Pyx_RefNannyFinishContext();
19710  return __pyx_r;
19711 }
19712 
19713 /* "subsurfaceTransportFunctions.pyx":884
19714  * v[eN,k,2]=zVelocity
19715  *
19716  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
19717  * double t,
19718  * double tForReversal,
19719  */
19720 
19721 /* Python wrapper */
19722 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19723 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4 = {"helicalElementVelocityEval4", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
19724 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19725  int __pyx_v_transient;
19726  double __pyx_v_t;
19727  double __pyx_v_tForReversal;
19728  double __pyx_v_clock;
19729  double __pyx_v_zVelocity;
19730  double __pyx_v_xc;
19731  double __pyx_v_yc;
19732  PyArrayObject *__pyx_v_x = 0;
19733  PyArrayObject *__pyx_v_v = 0;
19734  PyObject *__pyx_r = 0;
19735  __Pyx_RefNannyDeclarations
19736  __Pyx_RefNannySetupContext("helicalElementVelocityEval4 (wrapper)", 0);
19737  {
19738  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
19739  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
19740  if (unlikely(__pyx_kwds)) {
19741  Py_ssize_t kw_args;
19742  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19743  switch (pos_args) {
19744  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19745  CYTHON_FALLTHROUGH;
19746  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19747  CYTHON_FALLTHROUGH;
19748  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19749  CYTHON_FALLTHROUGH;
19750  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19751  CYTHON_FALLTHROUGH;
19752  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19753  CYTHON_FALLTHROUGH;
19754  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19755  CYTHON_FALLTHROUGH;
19756  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19757  CYTHON_FALLTHROUGH;
19758  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19759  CYTHON_FALLTHROUGH;
19760  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19761  CYTHON_FALLTHROUGH;
19762  case 0: break;
19763  default: goto __pyx_L5_argtuple_error;
19764  }
19765  kw_args = PyDict_Size(__pyx_kwds);
19766  switch (pos_args) {
19767  case 0:
19768  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
19769  else goto __pyx_L5_argtuple_error;
19770  CYTHON_FALLTHROUGH;
19771  case 1:
19772  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
19773  else {
19774  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 1); __PYX_ERR(0, 884, __pyx_L3_error)
19775  }
19776  CYTHON_FALLTHROUGH;
19777  case 2:
19778  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
19779  else {
19780  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 2); __PYX_ERR(0, 884, __pyx_L3_error)
19781  }
19782  CYTHON_FALLTHROUGH;
19783  case 3:
19784  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
19785  else {
19786  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 3); __PYX_ERR(0, 884, __pyx_L3_error)
19787  }
19788  CYTHON_FALLTHROUGH;
19789  case 4:
19790  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
19791  else {
19792  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 4); __PYX_ERR(0, 884, __pyx_L3_error)
19793  }
19794  CYTHON_FALLTHROUGH;
19795  case 5:
19796  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
19797  else {
19798  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 5); __PYX_ERR(0, 884, __pyx_L3_error)
19799  }
19800  CYTHON_FALLTHROUGH;
19801  case 6:
19802  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
19803  else {
19804  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 6); __PYX_ERR(0, 884, __pyx_L3_error)
19805  }
19806  CYTHON_FALLTHROUGH;
19807  case 7:
19808  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
19809  else {
19810  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 7); __PYX_ERR(0, 884, __pyx_L3_error)
19811  }
19812  CYTHON_FALLTHROUGH;
19813  case 8:
19814  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
19815  else {
19816  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 8); __PYX_ERR(0, 884, __pyx_L3_error)
19817  }
19818  }
19819  if (unlikely(kw_args > 0)) {
19820  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval4") < 0)) __PYX_ERR(0, 884, __pyx_L3_error)
19821  }
19822  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
19823  goto __pyx_L5_argtuple_error;
19824  } else {
19825  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19826  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19827  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19828  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19829  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19830  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19831  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19832  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19833  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19834  }
19835  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 884, __pyx_L3_error)
19836  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L3_error)
19837  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 886, __pyx_L3_error)
19838  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 887, __pyx_L3_error)
19839  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 888, __pyx_L3_error)
19840  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19841  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19842  __pyx_v_x = ((PyArrayObject *)values[7]);
19843  __pyx_v_v = ((PyArrayObject *)values[8]);
19844  }
19845  goto __pyx_L4_argument_unpacking_done;
19846  __pyx_L5_argtuple_error:;
19847  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 884, __pyx_L3_error)
19848  __pyx_L3_error:;
19849  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
19850  __Pyx_RefNannyFinishContext();
19851  return NULL;
19852  __pyx_L4_argument_unpacking_done:;
19853  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 890, __pyx_L1_error)
19854  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 891, __pyx_L1_error)
19855  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
19856 
19857  /* function exit code */
19858  goto __pyx_L0;
19859  __pyx_L1_error:;
19860  __pyx_r = NULL;
19861  __pyx_L0:;
19862  __Pyx_RefNannyFinishContext();
19863  return __pyx_r;
19864 }
19865 
19866 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19867  int __pyx_v_eN;
19868  int __pyx_v_ebN;
19869  int __pyx_v_k;
19870  double __pyx_v_pi;
19871  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19872  __Pyx_Buffer __pyx_pybuffer_v;
19873  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19874  __Pyx_Buffer __pyx_pybuffer_x;
19875  PyObject *__pyx_r = NULL;
19876  __Pyx_RefNannyDeclarations
19877  int __pyx_t_1;
19878  npy_intp __pyx_t_2;
19879  npy_intp __pyx_t_3;
19880  int __pyx_t_4;
19881  npy_intp __pyx_t_5;
19882  npy_intp __pyx_t_6;
19883  int __pyx_t_7;
19884  npy_intp __pyx_t_8;
19885  npy_intp __pyx_t_9;
19886  int __pyx_t_10;
19887  Py_ssize_t __pyx_t_11;
19888  Py_ssize_t __pyx_t_12;
19889  Py_ssize_t __pyx_t_13;
19890  Py_ssize_t __pyx_t_14;
19891  int __pyx_t_15;
19892  Py_ssize_t __pyx_t_16;
19893  Py_ssize_t __pyx_t_17;
19894  Py_ssize_t __pyx_t_18;
19895  Py_ssize_t __pyx_t_19;
19896  Py_ssize_t __pyx_t_20;
19897  Py_ssize_t __pyx_t_21;
19898  Py_ssize_t __pyx_t_22;
19899  Py_ssize_t __pyx_t_23;
19900  Py_ssize_t __pyx_t_24;
19901  Py_ssize_t __pyx_t_25;
19902  Py_ssize_t __pyx_t_26;
19903  Py_ssize_t __pyx_t_27;
19904  Py_ssize_t __pyx_t_28;
19905  Py_ssize_t __pyx_t_29;
19906  Py_ssize_t __pyx_t_30;
19907  Py_ssize_t __pyx_t_31;
19908  PyObject *__pyx_t_32 = NULL;
19909  PyObject *__pyx_t_33 = NULL;
19910  PyObject *__pyx_t_34 = NULL;
19911  PyObject *__pyx_t_35 = NULL;
19912  double __pyx_t_36;
19913  double __pyx_t_37;
19914  Py_ssize_t __pyx_t_38;
19915  Py_ssize_t __pyx_t_39;
19916  Py_ssize_t __pyx_t_40;
19917  Py_ssize_t __pyx_t_41;
19918  Py_ssize_t __pyx_t_42;
19919  Py_ssize_t __pyx_t_43;
19920  Py_ssize_t __pyx_t_44;
19921  Py_ssize_t __pyx_t_45;
19922  Py_ssize_t __pyx_t_46;
19923  Py_ssize_t __pyx_t_47;
19924  Py_ssize_t __pyx_t_48;
19925  Py_ssize_t __pyx_t_49;
19926  Py_ssize_t __pyx_t_50;
19927  Py_ssize_t __pyx_t_51;
19928  Py_ssize_t __pyx_t_52;
19929  Py_ssize_t __pyx_t_53;
19930  Py_ssize_t __pyx_t_54;
19931  Py_ssize_t __pyx_t_55;
19932  Py_ssize_t __pyx_t_56;
19933  Py_ssize_t __pyx_t_57;
19934  __Pyx_RefNannySetupContext("helicalElementVelocityEval4", 0);
19935  __pyx_pybuffer_x.pybuffer.buf = NULL;
19936  __pyx_pybuffer_x.refcount = 0;
19937  __pyx_pybuffernd_x.data = NULL;
19938  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19939  __pyx_pybuffer_v.pybuffer.buf = NULL;
19940  __pyx_pybuffer_v.refcount = 0;
19941  __pyx_pybuffernd_v.data = NULL;
19942  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19943  {
19944  __Pyx_BufFmt_StackElem __pyx_stack[1];
19945  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
19946  }
19947  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
19948  {
19949  __Pyx_BufFmt_StackElem __pyx_stack[1];
19950  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
19951  }
19952  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
19953 
19954  /* "subsurfaceTransportFunctions.pyx":894
19955  * cdef int eN,ebN,k
19956  * cdef double pi
19957  * pi = M_PI # <<<<<<<<<<<<<<
19958  * if transient == 1:
19959  * for eN in range(x.shape[0]):
19960  */
19961  __pyx_v_pi = M_PI;
19962 
19963  /* "subsurfaceTransportFunctions.pyx":895
19964  * cdef double pi
19965  * pi = M_PI
19966  * if transient == 1: # <<<<<<<<<<<<<<
19967  * for eN in range(x.shape[0]):
19968  * for ebN in range(x.shape[1]):
19969  */
19970  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
19971  if (__pyx_t_1) {
19972 
19973  /* "subsurfaceTransportFunctions.pyx":896
19974  * pi = M_PI
19975  * if transient == 1:
19976  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19977  * for ebN in range(x.shape[1]):
19978  * for k in range(x.shape[2]):
19979  */
19980  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19981  __pyx_t_3 = __pyx_t_2;
19982  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19983  __pyx_v_eN = __pyx_t_4;
19984 
19985  /* "subsurfaceTransportFunctions.pyx":897
19986  * if transient == 1:
19987  * for eN in range(x.shape[0]):
19988  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
19989  * for k in range(x.shape[2]):
19990  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19991  */
19992  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19993  __pyx_t_6 = __pyx_t_5;
19994  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19995  __pyx_v_ebN = __pyx_t_7;
19996 
19997  /* "subsurfaceTransportFunctions.pyx":898
19998  * for eN in range(x.shape[0]):
19999  * for ebN in range(x.shape[1]):
20000  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
20001  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20002  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20003  */
20004  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
20005  __pyx_t_9 = __pyx_t_8;
20006  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
20007  __pyx_v_k = __pyx_t_10;
20008 
20009  /* "subsurfaceTransportFunctions.pyx":899
20010  * for ebN in range(x.shape[1]):
20011  * for k in range(x.shape[2]):
20012  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
20013  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20014  * v[eN,ebN,k,2]=zVelocity
20015  */
20016  __pyx_t_11 = __pyx_v_eN;
20017  __pyx_t_12 = __pyx_v_ebN;
20018  __pyx_t_13 = __pyx_v_k;
20019  __pyx_t_14 = 1;
20020  __pyx_t_15 = -1;
20021  if (__pyx_t_11 < 0) {
20022  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
20023  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
20024  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20025  if (__pyx_t_12 < 0) {
20026  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20027  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
20028  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20029  if (__pyx_t_13 < 0) {
20030  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
20031  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
20032  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20033  if (__pyx_t_14 < 0) {
20034  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
20035  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
20036  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20037  if (unlikely(__pyx_t_15 != -1)) {
20038  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20039  __PYX_ERR(0, 899, __pyx_L1_error)
20040  }
20041  __pyx_t_16 = __pyx_v_eN;
20042  __pyx_t_17 = __pyx_v_ebN;
20043  __pyx_t_18 = __pyx_v_k;
20044  __pyx_t_19 = 0;
20045  __pyx_t_15 = -1;
20046  if (__pyx_t_16 < 0) {
20047  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
20048  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
20049  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20050  if (__pyx_t_17 < 0) {
20051  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
20052  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
20053  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20054  if (__pyx_t_18 < 0) {
20055  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
20056  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
20057  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20058  if (__pyx_t_19 < 0) {
20059  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
20060  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
20061  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20062  if (unlikely(__pyx_t_15 != -1)) {
20063  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20064  __PYX_ERR(0, 899, __pyx_L1_error)
20065  }
20066  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
20067 
20068  /* "subsurfaceTransportFunctions.pyx":900
20069  * for k in range(x.shape[2]):
20070  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20071  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
20072  * v[eN,ebN,k,2]=zVelocity
20073  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
20074  */
20075  __pyx_t_20 = __pyx_v_eN;
20076  __pyx_t_21 = __pyx_v_ebN;
20077  __pyx_t_22 = __pyx_v_k;
20078  __pyx_t_23 = 0;
20079  __pyx_t_15 = -1;
20080  if (__pyx_t_20 < 0) {
20081  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[0].shape;
20082  if (unlikely(__pyx_t_20 < 0)) __pyx_t_15 = 0;
20083  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20084  if (__pyx_t_21 < 0) {
20085  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[1].shape;
20086  if (unlikely(__pyx_t_21 < 0)) __pyx_t_15 = 1;
20087  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20088  if (__pyx_t_22 < 0) {
20089  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[2].shape;
20090  if (unlikely(__pyx_t_22 < 0)) __pyx_t_15 = 2;
20091  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20092  if (__pyx_t_23 < 0) {
20093  __pyx_t_23 += __pyx_pybuffernd_x.diminfo[3].shape;
20094  if (unlikely(__pyx_t_23 < 0)) __pyx_t_15 = 3;
20095  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20096  if (unlikely(__pyx_t_15 != -1)) {
20097  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20098  __PYX_ERR(0, 900, __pyx_L1_error)
20099  }
20100  __pyx_t_24 = __pyx_v_eN;
20101  __pyx_t_25 = __pyx_v_ebN;
20102  __pyx_t_26 = __pyx_v_k;
20103  __pyx_t_27 = 1;
20104  __pyx_t_15 = -1;
20105  if (__pyx_t_24 < 0) {
20106  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[0].shape;
20107  if (unlikely(__pyx_t_24 < 0)) __pyx_t_15 = 0;
20108  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20109  if (__pyx_t_25 < 0) {
20110  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[1].shape;
20111  if (unlikely(__pyx_t_25 < 0)) __pyx_t_15 = 1;
20112  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20113  if (__pyx_t_26 < 0) {
20114  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[2].shape;
20115  if (unlikely(__pyx_t_26 < 0)) __pyx_t_15 = 2;
20116  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20117  if (__pyx_t_27 < 0) {
20118  __pyx_t_27 += __pyx_pybuffernd_v.diminfo[3].shape;
20119  if (unlikely(__pyx_t_27 < 0)) __pyx_t_15 = 3;
20120  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20121  if (unlikely(__pyx_t_15 != -1)) {
20122  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20123  __PYX_ERR(0, 900, __pyx_L1_error)
20124  }
20125  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_27, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_23, __pyx_pybuffernd_x.diminfo[3].strides))));
20126 
20127  /* "subsurfaceTransportFunctions.pyx":901
20128  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20129  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20130  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
20131  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
20132  * else:
20133  */
20134  __pyx_t_28 = __pyx_v_eN;
20135  __pyx_t_29 = __pyx_v_ebN;
20136  __pyx_t_30 = __pyx_v_k;
20137  __pyx_t_31 = 2;
20138  __pyx_t_15 = -1;
20139  if (__pyx_t_28 < 0) {
20140  __pyx_t_28 += __pyx_pybuffernd_v.diminfo[0].shape;
20141  if (unlikely(__pyx_t_28 < 0)) __pyx_t_15 = 0;
20142  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20143  if (__pyx_t_29 < 0) {
20144  __pyx_t_29 += __pyx_pybuffernd_v.diminfo[1].shape;
20145  if (unlikely(__pyx_t_29 < 0)) __pyx_t_15 = 1;
20146  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20147  if (__pyx_t_30 < 0) {
20148  __pyx_t_30 += __pyx_pybuffernd_v.diminfo[2].shape;
20149  if (unlikely(__pyx_t_30 < 0)) __pyx_t_15 = 2;
20150  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20151  if (__pyx_t_31 < 0) {
20152  __pyx_t_31 += __pyx_pybuffernd_v.diminfo[3].shape;
20153  if (unlikely(__pyx_t_31 < 0)) __pyx_t_15 = 3;
20154  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20155  if (unlikely(__pyx_t_15 != -1)) {
20156  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20157  __PYX_ERR(0, 901, __pyx_L1_error)
20158  }
20159  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_31, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
20160 
20161  /* "subsurfaceTransportFunctions.pyx":902
20162  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20163  * v[eN,ebN,k,2]=zVelocity
20164  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
20165  * else:
20166  * for eN in range(x.shape[0]):
20167  */
20168  __pyx_t_32 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 902, __pyx_L1_error)
20169  __Pyx_GOTREF(__pyx_t_32);
20170  __pyx_t_33 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 902, __pyx_L1_error)
20171  __Pyx_GOTREF(__pyx_t_33);
20172  __pyx_t_34 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 902, __pyx_L1_error)
20173  __Pyx_GOTREF(__pyx_t_34);
20174  __pyx_t_35 = PyTuple_New(4); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 902, __pyx_L1_error)
20175  __Pyx_GOTREF(__pyx_t_35);
20176  __Pyx_GIVEREF(__pyx_t_32);
20177  PyTuple_SET_ITEM(__pyx_t_35, 0, __pyx_t_32);
20178  __Pyx_GIVEREF(__pyx_t_33);
20179  PyTuple_SET_ITEM(__pyx_t_35, 1, __pyx_t_33);
20180  __Pyx_GIVEREF(__pyx_t_34);
20181  PyTuple_SET_ITEM(__pyx_t_35, 2, __pyx_t_34);
20182  __Pyx_INCREF(__pyx_slice__8);
20183  __Pyx_GIVEREF(__pyx_slice__8);
20184  PyTuple_SET_ITEM(__pyx_t_35, 3, __pyx_slice__8);
20185  __pyx_t_32 = 0;
20186  __pyx_t_33 = 0;
20187  __pyx_t_34 = 0;
20188  __pyx_t_34 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_35); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 902, __pyx_L1_error)
20189  __Pyx_GOTREF(__pyx_t_34);
20190  __pyx_t_36 = (__pyx_v_pi * __pyx_v_t);
20191  __pyx_t_37 = (__pyx_v_tForReversal * 2.0);
20192  if (unlikely(__pyx_t_37 == 0)) {
20193  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
20194  __PYX_ERR(0, 902, __pyx_L1_error)
20195  }
20196  __pyx_t_33 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_36 / __pyx_t_37)))); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 902, __pyx_L1_error)
20197  __Pyx_GOTREF(__pyx_t_33);
20198  __pyx_t_32 = PyNumber_InPlaceMultiply(__pyx_t_34, __pyx_t_33); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 902, __pyx_L1_error)
20199  __Pyx_GOTREF(__pyx_t_32);
20200  __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
20201  __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
20202  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_35, __pyx_t_32) < 0)) __PYX_ERR(0, 902, __pyx_L1_error)
20203  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
20204  __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
20205  }
20206  }
20207  }
20208 
20209  /* "subsurfaceTransportFunctions.pyx":895
20210  * cdef double pi
20211  * pi = M_PI
20212  * if transient == 1: # <<<<<<<<<<<<<<
20213  * for eN in range(x.shape[0]):
20214  * for ebN in range(x.shape[1]):
20215  */
20216  goto __pyx_L3;
20217  }
20218 
20219  /* "subsurfaceTransportFunctions.pyx":904
20220  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
20221  * else:
20222  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20223  * for ebN in range(x.shape[1]):
20224  * for k in range(x.shape[2]):
20225  */
20226  /*else*/ {
20227  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
20228  __pyx_t_3 = __pyx_t_2;
20229  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20230  __pyx_v_eN = __pyx_t_4;
20231 
20232  /* "subsurfaceTransportFunctions.pyx":905
20233  * else:
20234  * for eN in range(x.shape[0]):
20235  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
20236  * for k in range(x.shape[2]):
20237  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20238  */
20239  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
20240  __pyx_t_6 = __pyx_t_5;
20241  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
20242  __pyx_v_ebN = __pyx_t_7;
20243 
20244  /* "subsurfaceTransportFunctions.pyx":906
20245  * for eN in range(x.shape[0]):
20246  * for ebN in range(x.shape[1]):
20247  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
20248  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20249  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20250  */
20251  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
20252  __pyx_t_9 = __pyx_t_8;
20253  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
20254  __pyx_v_k = __pyx_t_10;
20255 
20256  /* "subsurfaceTransportFunctions.pyx":907
20257  * for ebN in range(x.shape[1]):
20258  * for k in range(x.shape[2]):
20259  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
20260  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20261  * v[eN,ebN,k,2]=zVelocity
20262  */
20263  __pyx_t_38 = __pyx_v_eN;
20264  __pyx_t_39 = __pyx_v_ebN;
20265  __pyx_t_40 = __pyx_v_k;
20266  __pyx_t_41 = 1;
20267  __pyx_t_15 = -1;
20268  if (__pyx_t_38 < 0) {
20269  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[0].shape;
20270  if (unlikely(__pyx_t_38 < 0)) __pyx_t_15 = 0;
20271  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20272  if (__pyx_t_39 < 0) {
20273  __pyx_t_39 += __pyx_pybuffernd_x.diminfo[1].shape;
20274  if (unlikely(__pyx_t_39 < 0)) __pyx_t_15 = 1;
20275  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20276  if (__pyx_t_40 < 0) {
20277  __pyx_t_40 += __pyx_pybuffernd_x.diminfo[2].shape;
20278  if (unlikely(__pyx_t_40 < 0)) __pyx_t_15 = 2;
20279  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20280  if (__pyx_t_41 < 0) {
20281  __pyx_t_41 += __pyx_pybuffernd_x.diminfo[3].shape;
20282  if (unlikely(__pyx_t_41 < 0)) __pyx_t_15 = 3;
20283  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20284  if (unlikely(__pyx_t_15 != -1)) {
20285  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20286  __PYX_ERR(0, 907, __pyx_L1_error)
20287  }
20288  __pyx_t_42 = __pyx_v_eN;
20289  __pyx_t_43 = __pyx_v_ebN;
20290  __pyx_t_44 = __pyx_v_k;
20291  __pyx_t_45 = 0;
20292  __pyx_t_15 = -1;
20293  if (__pyx_t_42 < 0) {
20294  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[0].shape;
20295  if (unlikely(__pyx_t_42 < 0)) __pyx_t_15 = 0;
20296  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20297  if (__pyx_t_43 < 0) {
20298  __pyx_t_43 += __pyx_pybuffernd_v.diminfo[1].shape;
20299  if (unlikely(__pyx_t_43 < 0)) __pyx_t_15 = 1;
20300  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20301  if (__pyx_t_44 < 0) {
20302  __pyx_t_44 += __pyx_pybuffernd_v.diminfo[2].shape;
20303  if (unlikely(__pyx_t_44 < 0)) __pyx_t_15 = 2;
20304  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20305  if (__pyx_t_45 < 0) {
20306  __pyx_t_45 += __pyx_pybuffernd_v.diminfo[3].shape;
20307  if (unlikely(__pyx_t_45 < 0)) __pyx_t_15 = 3;
20308  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20309  if (unlikely(__pyx_t_15 != -1)) {
20310  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20311  __PYX_ERR(0, 907, __pyx_L1_error)
20312  }
20313  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_45, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_40, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_41, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
20314 
20315  /* "subsurfaceTransportFunctions.pyx":908
20316  * for k in range(x.shape[2]):
20317  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20318  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
20319  * v[eN,ebN,k,2]=zVelocity
20320  *
20321  */
20322  __pyx_t_46 = __pyx_v_eN;
20323  __pyx_t_47 = __pyx_v_ebN;
20324  __pyx_t_48 = __pyx_v_k;
20325  __pyx_t_49 = 0;
20326  __pyx_t_15 = -1;
20327  if (__pyx_t_46 < 0) {
20328  __pyx_t_46 += __pyx_pybuffernd_x.diminfo[0].shape;
20329  if (unlikely(__pyx_t_46 < 0)) __pyx_t_15 = 0;
20330  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20331  if (__pyx_t_47 < 0) {
20332  __pyx_t_47 += __pyx_pybuffernd_x.diminfo[1].shape;
20333  if (unlikely(__pyx_t_47 < 0)) __pyx_t_15 = 1;
20334  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20335  if (__pyx_t_48 < 0) {
20336  __pyx_t_48 += __pyx_pybuffernd_x.diminfo[2].shape;
20337  if (unlikely(__pyx_t_48 < 0)) __pyx_t_15 = 2;
20338  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20339  if (__pyx_t_49 < 0) {
20340  __pyx_t_49 += __pyx_pybuffernd_x.diminfo[3].shape;
20341  if (unlikely(__pyx_t_49 < 0)) __pyx_t_15 = 3;
20342  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20343  if (unlikely(__pyx_t_15 != -1)) {
20344  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20345  __PYX_ERR(0, 908, __pyx_L1_error)
20346  }
20347  __pyx_t_50 = __pyx_v_eN;
20348  __pyx_t_51 = __pyx_v_ebN;
20349  __pyx_t_52 = __pyx_v_k;
20350  __pyx_t_53 = 1;
20351  __pyx_t_15 = -1;
20352  if (__pyx_t_50 < 0) {
20353  __pyx_t_50 += __pyx_pybuffernd_v.diminfo[0].shape;
20354  if (unlikely(__pyx_t_50 < 0)) __pyx_t_15 = 0;
20355  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20356  if (__pyx_t_51 < 0) {
20357  __pyx_t_51 += __pyx_pybuffernd_v.diminfo[1].shape;
20358  if (unlikely(__pyx_t_51 < 0)) __pyx_t_15 = 1;
20359  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20360  if (__pyx_t_52 < 0) {
20361  __pyx_t_52 += __pyx_pybuffernd_v.diminfo[2].shape;
20362  if (unlikely(__pyx_t_52 < 0)) __pyx_t_15 = 2;
20363  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20364  if (__pyx_t_53 < 0) {
20365  __pyx_t_53 += __pyx_pybuffernd_v.diminfo[3].shape;
20366  if (unlikely(__pyx_t_53 < 0)) __pyx_t_15 = 3;
20367  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20368  if (unlikely(__pyx_t_15 != -1)) {
20369  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20370  __PYX_ERR(0, 908, __pyx_L1_error)
20371  }
20372  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_52, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_53, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_48, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_49, __pyx_pybuffernd_x.diminfo[3].strides))));
20373 
20374  /* "subsurfaceTransportFunctions.pyx":909
20375  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20376  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20377  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
20378  *
20379  * def vortexElementVelocityEval3(double t,
20380  */
20381  __pyx_t_54 = __pyx_v_eN;
20382  __pyx_t_55 = __pyx_v_ebN;
20383  __pyx_t_56 = __pyx_v_k;
20384  __pyx_t_57 = 2;
20385  __pyx_t_15 = -1;
20386  if (__pyx_t_54 < 0) {
20387  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[0].shape;
20388  if (unlikely(__pyx_t_54 < 0)) __pyx_t_15 = 0;
20389  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20390  if (__pyx_t_55 < 0) {
20391  __pyx_t_55 += __pyx_pybuffernd_v.diminfo[1].shape;
20392  if (unlikely(__pyx_t_55 < 0)) __pyx_t_15 = 1;
20393  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20394  if (__pyx_t_56 < 0) {
20395  __pyx_t_56 += __pyx_pybuffernd_v.diminfo[2].shape;
20396  if (unlikely(__pyx_t_56 < 0)) __pyx_t_15 = 2;
20397  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20398  if (__pyx_t_57 < 0) {
20399  __pyx_t_57 += __pyx_pybuffernd_v.diminfo[3].shape;
20400  if (unlikely(__pyx_t_57 < 0)) __pyx_t_15 = 3;
20401  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20402  if (unlikely(__pyx_t_15 != -1)) {
20403  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20404  __PYX_ERR(0, 909, __pyx_L1_error)
20405  }
20406  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_57, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
20407  }
20408  }
20409  }
20410  }
20411  __pyx_L3:;
20412 
20413  /* "subsurfaceTransportFunctions.pyx":884
20414  * v[eN,k,2]=zVelocity
20415  *
20416  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
20417  * double t,
20418  * double tForReversal,
20419  */
20420 
20421  /* function exit code */
20422  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20423  goto __pyx_L0;
20424  __pyx_L1_error:;
20425  __Pyx_XDECREF(__pyx_t_32);
20426  __Pyx_XDECREF(__pyx_t_33);
20427  __Pyx_XDECREF(__pyx_t_34);
20428  __Pyx_XDECREF(__pyx_t_35);
20429  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20430  __Pyx_PyThreadState_declare
20431  __Pyx_PyThreadState_assign
20432  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20433  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20434  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20435  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20436  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20437  __pyx_r = NULL;
20438  goto __pyx_L2;
20439  __pyx_L0:;
20440  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20441  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20442  __pyx_L2:;
20443  __Pyx_XGIVEREF(__pyx_r);
20444  __Pyx_RefNannyFinishContext();
20445  return __pyx_r;
20446 }
20447 
20448 /* "subsurfaceTransportFunctions.pyx":911
20449  * v[eN,ebN,k,2]=zVelocity
20450  *
20451  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
20452  * numpy.ndarray[DTYPE_t,ndim=3] x,
20453  * numpy.ndarray[DTYPE_t,ndim=3] v):
20454  */
20455 
20456 /* Python wrapper */
20457 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20458 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3 = {"vortexElementVelocityEval3", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
20459 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20460  double __pyx_v_t;
20461  PyArrayObject *__pyx_v_x = 0;
20462  PyArrayObject *__pyx_v_v = 0;
20463  PyObject *__pyx_r = 0;
20464  __Pyx_RefNannyDeclarations
20465  __Pyx_RefNannySetupContext("vortexElementVelocityEval3 (wrapper)", 0);
20466  {
20467  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
20468  PyObject* values[3] = {0,0,0};
20469  if (unlikely(__pyx_kwds)) {
20470  Py_ssize_t kw_args;
20471  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20472  switch (pos_args) {
20473  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20474  CYTHON_FALLTHROUGH;
20475  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20476  CYTHON_FALLTHROUGH;
20477  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20478  CYTHON_FALLTHROUGH;
20479  case 0: break;
20480  default: goto __pyx_L5_argtuple_error;
20481  }
20482  kw_args = PyDict_Size(__pyx_kwds);
20483  switch (pos_args) {
20484  case 0:
20485  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
20486  else goto __pyx_L5_argtuple_error;
20487  CYTHON_FALLTHROUGH;
20488  case 1:
20489  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
20490  else {
20491  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 1); __PYX_ERR(0, 911, __pyx_L3_error)
20492  }
20493  CYTHON_FALLTHROUGH;
20494  case 2:
20495  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
20496  else {
20497  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 2); __PYX_ERR(0, 911, __pyx_L3_error)
20498  }
20499  }
20500  if (unlikely(kw_args > 0)) {
20501  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval3") < 0)) __PYX_ERR(0, 911, __pyx_L3_error)
20502  }
20503  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20504  goto __pyx_L5_argtuple_error;
20505  } else {
20506  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20507  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20508  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20509  }
20510  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 911, __pyx_L3_error)
20511  __pyx_v_x = ((PyArrayObject *)values[1]);
20512  __pyx_v_v = ((PyArrayObject *)values[2]);
20513  }
20514  goto __pyx_L4_argument_unpacking_done;
20515  __pyx_L5_argtuple_error:;
20516  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 911, __pyx_L3_error)
20517  __pyx_L3_error:;
20518  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20519  __Pyx_RefNannyFinishContext();
20520  return NULL;
20521  __pyx_L4_argument_unpacking_done:;
20522  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 912, __pyx_L1_error)
20523  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 913, __pyx_L1_error)
20524  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
20525 
20526  /* function exit code */
20527  goto __pyx_L0;
20528  __pyx_L1_error:;
20529  __pyx_r = NULL;
20530  __pyx_L0:;
20531  __Pyx_RefNannyFinishContext();
20532  return __pyx_r;
20533 }
20534 
20535 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
20536  int __pyx_v_eN;
20537  int __pyx_v_k;
20538  double __pyx_v_pi;
20539  double __pyx_v_one8;
20540  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
20541  __Pyx_Buffer __pyx_pybuffer_v;
20542  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
20543  __Pyx_Buffer __pyx_pybuffer_x;
20544  PyObject *__pyx_r = NULL;
20545  __Pyx_RefNannyDeclarations
20546  npy_intp __pyx_t_1;
20547  npy_intp __pyx_t_2;
20548  int __pyx_t_3;
20549  npy_intp __pyx_t_4;
20550  npy_intp __pyx_t_5;
20551  int __pyx_t_6;
20552  Py_ssize_t __pyx_t_7;
20553  Py_ssize_t __pyx_t_8;
20554  Py_ssize_t __pyx_t_9;
20555  int __pyx_t_10;
20556  Py_ssize_t __pyx_t_11;
20557  Py_ssize_t __pyx_t_12;
20558  Py_ssize_t __pyx_t_13;
20559  Py_ssize_t __pyx_t_14;
20560  Py_ssize_t __pyx_t_15;
20561  Py_ssize_t __pyx_t_16;
20562  Py_ssize_t __pyx_t_17;
20563  Py_ssize_t __pyx_t_18;
20564  Py_ssize_t __pyx_t_19;
20565  Py_ssize_t __pyx_t_20;
20566  Py_ssize_t __pyx_t_21;
20567  Py_ssize_t __pyx_t_22;
20568  Py_ssize_t __pyx_t_23;
20569  Py_ssize_t __pyx_t_24;
20570  Py_ssize_t __pyx_t_25;
20571  Py_ssize_t __pyx_t_26;
20572  Py_ssize_t __pyx_t_27;
20573  Py_ssize_t __pyx_t_28;
20574  Py_ssize_t __pyx_t_29;
20575  Py_ssize_t __pyx_t_30;
20576  Py_ssize_t __pyx_t_31;
20577  __Pyx_RefNannySetupContext("vortexElementVelocityEval3", 0);
20578  __pyx_pybuffer_x.pybuffer.buf = NULL;
20579  __pyx_pybuffer_x.refcount = 0;
20580  __pyx_pybuffernd_x.data = NULL;
20581  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
20582  __pyx_pybuffer_v.pybuffer.buf = NULL;
20583  __pyx_pybuffer_v.refcount = 0;
20584  __pyx_pybuffernd_v.data = NULL;
20585  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
20586  {
20587  __Pyx_BufFmt_StackElem __pyx_stack[1];
20588  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 911, __pyx_L1_error)
20589  }
20590  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
20591  {
20592  __Pyx_BufFmt_StackElem __pyx_stack[1];
20593  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 911, __pyx_L1_error)
20594  }
20595  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
20596 
20597  /* "subsurfaceTransportFunctions.pyx":916
20598  * cdef int eN,k
20599  * cdef double pi,one8
20600  * pi = M_PI # <<<<<<<<<<<<<<
20601  * one8 = 1.0/8.0
20602  * for eN in range(x.shape[0]):
20603  */
20604  __pyx_v_pi = M_PI;
20605 
20606  /* "subsurfaceTransportFunctions.pyx":917
20607  * cdef double pi,one8
20608  * pi = M_PI
20609  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
20610  * for eN in range(x.shape[0]):
20611  * for k in range(x.shape[1]):
20612  */
20613  __pyx_v_one8 = (1.0 / 8.0);
20614 
20615  /* "subsurfaceTransportFunctions.pyx":918
20616  * pi = M_PI
20617  * one8 = 1.0/8.0
20618  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20619  * for k in range(x.shape[1]):
20620  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20621  */
20622  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
20623  __pyx_t_2 = __pyx_t_1;
20624  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20625  __pyx_v_eN = __pyx_t_3;
20626 
20627  /* "subsurfaceTransportFunctions.pyx":919
20628  * one8 = 1.0/8.0
20629  * for eN in range(x.shape[0]):
20630  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
20631  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20632  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
20633  */
20634  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
20635  __pyx_t_5 = __pyx_t_4;
20636  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
20637  __pyx_v_k = __pyx_t_6;
20638 
20639  /* "subsurfaceTransportFunctions.pyx":920
20640  * for eN in range(x.shape[0]):
20641  * for k in range(x.shape[1]):
20642  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]); # <<<<<<<<<<<<<<
20643  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
20644  *
20645  */
20646  __pyx_t_7 = __pyx_v_eN;
20647  __pyx_t_8 = __pyx_v_k;
20648  __pyx_t_9 = 1;
20649  __pyx_t_10 = -1;
20650  if (__pyx_t_7 < 0) {
20651  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[0].shape;
20652  if (unlikely(__pyx_t_7 < 0)) __pyx_t_10 = 0;
20653  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20654  if (__pyx_t_8 < 0) {
20655  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[1].shape;
20656  if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 1;
20657  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20658  if (__pyx_t_9 < 0) {
20659  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[2].shape;
20660  if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 2;
20661  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20662  if (unlikely(__pyx_t_10 != -1)) {
20663  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20664  __PYX_ERR(0, 920, __pyx_L1_error)
20665  }
20666  __pyx_t_11 = __pyx_v_eN;
20667  __pyx_t_12 = __pyx_v_k;
20668  __pyx_t_13 = 0;
20669  __pyx_t_10 = -1;
20670  if (__pyx_t_11 < 0) {
20671  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
20672  if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
20673  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20674  if (__pyx_t_12 < 0) {
20675  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20676  if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
20677  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20678  if (__pyx_t_13 < 0) {
20679  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
20680  if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 2;
20681  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20682  if (unlikely(__pyx_t_10 != -1)) {
20683  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20684  __PYX_ERR(0, 920, __pyx_L1_error)
20685  }
20686  __pyx_t_14 = __pyx_v_eN;
20687  __pyx_t_15 = __pyx_v_k;
20688  __pyx_t_16 = 0;
20689  __pyx_t_10 = -1;
20690  if (__pyx_t_14 < 0) {
20691  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
20692  if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 0;
20693  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20694  if (__pyx_t_15 < 0) {
20695  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[1].shape;
20696  if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 1;
20697  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20698  if (__pyx_t_16 < 0) {
20699  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[2].shape;
20700  if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 2;
20701  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20702  if (unlikely(__pyx_t_10 != -1)) {
20703  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20704  __PYX_ERR(0, 920, __pyx_L1_error)
20705  }
20706  __pyx_t_17 = __pyx_v_eN;
20707  __pyx_t_18 = __pyx_v_k;
20708  __pyx_t_19 = 0;
20709  __pyx_t_10 = -1;
20710  if (__pyx_t_17 < 0) {
20711  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[0].shape;
20712  if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 0;
20713  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_10 = 0;
20714  if (__pyx_t_18 < 0) {
20715  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
20716  if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 1;
20717  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_10 = 1;
20718  if (__pyx_t_19 < 0) {
20719  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[2].shape;
20720  if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 2;
20721  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_10 = 2;
20722  if (unlikely(__pyx_t_10 != -1)) {
20723  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20724  __PYX_ERR(0, 920, __pyx_L1_error)
20725  }
20726  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[2].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[2].strides)))));
20727 
20728  /* "subsurfaceTransportFunctions.pyx":921
20729  * for k in range(x.shape[1]):
20730  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20731  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]); # <<<<<<<<<<<<<<
20732  *
20733  *
20734  */
20735  __pyx_t_20 = __pyx_v_eN;
20736  __pyx_t_21 = __pyx_v_k;
20737  __pyx_t_22 = 0;
20738  __pyx_t_10 = -1;
20739  if (__pyx_t_20 < 0) {
20740  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[0].shape;
20741  if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 0;
20742  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20743  if (__pyx_t_21 < 0) {
20744  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[1].shape;
20745  if (unlikely(__pyx_t_21 < 0)) __pyx_t_10 = 1;
20746  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20747  if (__pyx_t_22 < 0) {
20748  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[2].shape;
20749  if (unlikely(__pyx_t_22 < 0)) __pyx_t_10 = 2;
20750  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20751  if (unlikely(__pyx_t_10 != -1)) {
20752  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20753  __PYX_ERR(0, 921, __pyx_L1_error)
20754  }
20755  __pyx_t_23 = __pyx_v_eN;
20756  __pyx_t_24 = __pyx_v_k;
20757  __pyx_t_25 = 1;
20758  __pyx_t_10 = -1;
20759  if (__pyx_t_23 < 0) {
20760  __pyx_t_23 += __pyx_pybuffernd_x.diminfo[0].shape;
20761  if (unlikely(__pyx_t_23 < 0)) __pyx_t_10 = 0;
20762  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20763  if (__pyx_t_24 < 0) {
20764  __pyx_t_24 += __pyx_pybuffernd_x.diminfo[1].shape;
20765  if (unlikely(__pyx_t_24 < 0)) __pyx_t_10 = 1;
20766  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20767  if (__pyx_t_25 < 0) {
20768  __pyx_t_25 += __pyx_pybuffernd_x.diminfo[2].shape;
20769  if (unlikely(__pyx_t_25 < 0)) __pyx_t_10 = 2;
20770  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20771  if (unlikely(__pyx_t_10 != -1)) {
20772  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20773  __PYX_ERR(0, 921, __pyx_L1_error)
20774  }
20775  __pyx_t_26 = __pyx_v_eN;
20776  __pyx_t_27 = __pyx_v_k;
20777  __pyx_t_28 = 1;
20778  __pyx_t_10 = -1;
20779  if (__pyx_t_26 < 0) {
20780  __pyx_t_26 += __pyx_pybuffernd_x.diminfo[0].shape;
20781  if (unlikely(__pyx_t_26 < 0)) __pyx_t_10 = 0;
20782  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20783  if (__pyx_t_27 < 0) {
20784  __pyx_t_27 += __pyx_pybuffernd_x.diminfo[1].shape;
20785  if (unlikely(__pyx_t_27 < 0)) __pyx_t_10 = 1;
20786  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20787  if (__pyx_t_28 < 0) {
20788  __pyx_t_28 += __pyx_pybuffernd_x.diminfo[2].shape;
20789  if (unlikely(__pyx_t_28 < 0)) __pyx_t_10 = 2;
20790  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20791  if (unlikely(__pyx_t_10 != -1)) {
20792  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20793  __PYX_ERR(0, 921, __pyx_L1_error)
20794  }
20795  __pyx_t_29 = __pyx_v_eN;
20796  __pyx_t_30 = __pyx_v_k;
20797  __pyx_t_31 = 1;
20798  __pyx_t_10 = -1;
20799  if (__pyx_t_29 < 0) {
20800  __pyx_t_29 += __pyx_pybuffernd_v.diminfo[0].shape;
20801  if (unlikely(__pyx_t_29 < 0)) __pyx_t_10 = 0;
20802  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_10 = 0;
20803  if (__pyx_t_30 < 0) {
20804  __pyx_t_30 += __pyx_pybuffernd_v.diminfo[1].shape;
20805  if (unlikely(__pyx_t_30 < 0)) __pyx_t_10 = 1;
20806  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_10 = 1;
20807  if (__pyx_t_31 < 0) {
20808  __pyx_t_31 += __pyx_pybuffernd_v.diminfo[2].shape;
20809  if (unlikely(__pyx_t_31 < 0)) __pyx_t_10 = 2;
20810  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_10 = 2;
20811  if (unlikely(__pyx_t_10 != -1)) {
20812  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20813  __PYX_ERR(0, 921, __pyx_L1_error)
20814  }
20815  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_31, __pyx_pybuffernd_v.diminfo[2].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_28, __pyx_pybuffernd_x.diminfo[2].strides)))));
20816  }
20817  }
20818 
20819  /* "subsurfaceTransportFunctions.pyx":911
20820  * v[eN,ebN,k,2]=zVelocity
20821  *
20822  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
20823  * numpy.ndarray[DTYPE_t,ndim=3] x,
20824  * numpy.ndarray[DTYPE_t,ndim=3] v):
20825  */
20826 
20827  /* function exit code */
20828  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20829  goto __pyx_L0;
20830  __pyx_L1_error:;
20831  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20832  __Pyx_PyThreadState_declare
20833  __Pyx_PyThreadState_assign
20834  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20835  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20836  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20837  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20838  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20839  __pyx_r = NULL;
20840  goto __pyx_L2;
20841  __pyx_L0:;
20842  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20843  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20844  __pyx_L2:;
20845  __Pyx_XGIVEREF(__pyx_r);
20846  __Pyx_RefNannyFinishContext();
20847  return __pyx_r;
20848 }
20849 
20850 /* "subsurfaceTransportFunctions.pyx":924
20851  *
20852  *
20853  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
20854  * numpy.ndarray[DTYPE_t,ndim=4] x,
20855  * numpy.ndarray[DTYPE_t,ndim=4] v):
20856  */
20857 
20858 /* Python wrapper */
20859 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20860 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4 = {"vortexElementVelocityEval4", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
20861 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20862  double __pyx_v_t;
20863  PyArrayObject *__pyx_v_x = 0;
20864  PyArrayObject *__pyx_v_v = 0;
20865  PyObject *__pyx_r = 0;
20866  __Pyx_RefNannyDeclarations
20867  __Pyx_RefNannySetupContext("vortexElementVelocityEval4 (wrapper)", 0);
20868  {
20869  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
20870  PyObject* values[3] = {0,0,0};
20871  if (unlikely(__pyx_kwds)) {
20872  Py_ssize_t kw_args;
20873  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20874  switch (pos_args) {
20875  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20876  CYTHON_FALLTHROUGH;
20877  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20878  CYTHON_FALLTHROUGH;
20879  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20880  CYTHON_FALLTHROUGH;
20881  case 0: break;
20882  default: goto __pyx_L5_argtuple_error;
20883  }
20884  kw_args = PyDict_Size(__pyx_kwds);
20885  switch (pos_args) {
20886  case 0:
20887  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
20888  else goto __pyx_L5_argtuple_error;
20889  CYTHON_FALLTHROUGH;
20890  case 1:
20891  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
20892  else {
20893  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 1); __PYX_ERR(0, 924, __pyx_L3_error)
20894  }
20895  CYTHON_FALLTHROUGH;
20896  case 2:
20897  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
20898  else {
20899  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 2); __PYX_ERR(0, 924, __pyx_L3_error)
20900  }
20901  }
20902  if (unlikely(kw_args > 0)) {
20903  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval4") < 0)) __PYX_ERR(0, 924, __pyx_L3_error)
20904  }
20905  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20906  goto __pyx_L5_argtuple_error;
20907  } else {
20908  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20909  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20910  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20911  }
20912  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 924, __pyx_L3_error)
20913  __pyx_v_x = ((PyArrayObject *)values[1]);
20914  __pyx_v_v = ((PyArrayObject *)values[2]);
20915  }
20916  goto __pyx_L4_argument_unpacking_done;
20917  __pyx_L5_argtuple_error:;
20918  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 924, __pyx_L3_error)
20919  __pyx_L3_error:;
20920  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20921  __Pyx_RefNannyFinishContext();
20922  return NULL;
20923  __pyx_L4_argument_unpacking_done:;
20924  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 925, __pyx_L1_error)
20925  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 926, __pyx_L1_error)
20926  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
20927 
20928  /* function exit code */
20929  goto __pyx_L0;
20930  __pyx_L1_error:;
20931  __pyx_r = NULL;
20932  __pyx_L0:;
20933  __Pyx_RefNannyFinishContext();
20934  return __pyx_r;
20935 }
20936 
20937 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
20938  int __pyx_v_eN;
20939  int __pyx_v_k;
20940  int __pyx_v_ebN;
20941  double __pyx_v_pi;
20942  double __pyx_v_one8;
20943  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
20944  __Pyx_Buffer __pyx_pybuffer_v;
20945  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
20946  __Pyx_Buffer __pyx_pybuffer_x;
20947  PyObject *__pyx_r = NULL;
20948  __Pyx_RefNannyDeclarations
20949  npy_intp __pyx_t_1;
20950  npy_intp __pyx_t_2;
20951  int __pyx_t_3;
20952  npy_intp __pyx_t_4;
20953  npy_intp __pyx_t_5;
20954  int __pyx_t_6;
20955  npy_intp __pyx_t_7;
20956  npy_intp __pyx_t_8;
20957  int __pyx_t_9;
20958  Py_ssize_t __pyx_t_10;
20959  Py_ssize_t __pyx_t_11;
20960  Py_ssize_t __pyx_t_12;
20961  Py_ssize_t __pyx_t_13;
20962  int __pyx_t_14;
20963  Py_ssize_t __pyx_t_15;
20964  Py_ssize_t __pyx_t_16;
20965  Py_ssize_t __pyx_t_17;
20966  Py_ssize_t __pyx_t_18;
20967  Py_ssize_t __pyx_t_19;
20968  Py_ssize_t __pyx_t_20;
20969  Py_ssize_t __pyx_t_21;
20970  Py_ssize_t __pyx_t_22;
20971  Py_ssize_t __pyx_t_23;
20972  Py_ssize_t __pyx_t_24;
20973  Py_ssize_t __pyx_t_25;
20974  Py_ssize_t __pyx_t_26;
20975  Py_ssize_t __pyx_t_27;
20976  Py_ssize_t __pyx_t_28;
20977  Py_ssize_t __pyx_t_29;
20978  Py_ssize_t __pyx_t_30;
20979  Py_ssize_t __pyx_t_31;
20980  Py_ssize_t __pyx_t_32;
20981  Py_ssize_t __pyx_t_33;
20982  Py_ssize_t __pyx_t_34;
20983  Py_ssize_t __pyx_t_35;
20984  Py_ssize_t __pyx_t_36;
20985  Py_ssize_t __pyx_t_37;
20986  Py_ssize_t __pyx_t_38;
20987  Py_ssize_t __pyx_t_39;
20988  Py_ssize_t __pyx_t_40;
20989  Py_ssize_t __pyx_t_41;
20990  Py_ssize_t __pyx_t_42;
20991  __Pyx_RefNannySetupContext("vortexElementVelocityEval4", 0);
20992  __pyx_pybuffer_x.pybuffer.buf = NULL;
20993  __pyx_pybuffer_x.refcount = 0;
20994  __pyx_pybuffernd_x.data = NULL;
20995  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
20996  __pyx_pybuffer_v.pybuffer.buf = NULL;
20997  __pyx_pybuffer_v.refcount = 0;
20998  __pyx_pybuffernd_v.data = NULL;
20999  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
21000  {
21001  __Pyx_BufFmt_StackElem __pyx_stack[1];
21002  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 924, __pyx_L1_error)
21003  }
21004  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
21005  {
21006  __Pyx_BufFmt_StackElem __pyx_stack[1];
21007  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 924, __pyx_L1_error)
21008  }
21009  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
21010 
21011  /* "subsurfaceTransportFunctions.pyx":929
21012  * cdef int eN,k,ebN
21013  * cdef double pi,one8
21014  * pi = M_PI # <<<<<<<<<<<<<<
21015  * one8 = 1.0/8.0
21016  * for eN in range(x.shape[0]):
21017  */
21018  __pyx_v_pi = M_PI;
21019 
21020  /* "subsurfaceTransportFunctions.pyx":930
21021  * cdef double pi,one8
21022  * pi = M_PI
21023  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
21024  * for eN in range(x.shape[0]):
21025  * for ebN in range(x.shape[1]):
21026  */
21027  __pyx_v_one8 = (1.0 / 8.0);
21028 
21029  /* "subsurfaceTransportFunctions.pyx":931
21030  * pi = M_PI
21031  * one8 = 1.0/8.0
21032  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
21033  * for ebN in range(x.shape[1]):
21034  * for k in range(x.shape[2]):
21035  */
21036  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
21037  __pyx_t_2 = __pyx_t_1;
21038  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
21039  __pyx_v_eN = __pyx_t_3;
21040 
21041  /* "subsurfaceTransportFunctions.pyx":932
21042  * one8 = 1.0/8.0
21043  * for eN in range(x.shape[0]):
21044  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
21045  * for k in range(x.shape[2]):
21046  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
21047  */
21048  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
21049  __pyx_t_5 = __pyx_t_4;
21050  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21051  __pyx_v_ebN = __pyx_t_6;
21052 
21053  /* "subsurfaceTransportFunctions.pyx":933
21054  * for eN in range(x.shape[0]):
21055  * for ebN in range(x.shape[1]):
21056  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
21057  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
21058  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
21059  */
21060  __pyx_t_7 = (__pyx_v_x->dimensions[2]);
21061  __pyx_t_8 = __pyx_t_7;
21062  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
21063  __pyx_v_k = __pyx_t_9;
21064 
21065  /* "subsurfaceTransportFunctions.pyx":934
21066  * for ebN in range(x.shape[1]):
21067  * for k in range(x.shape[2]):
21068  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]); # <<<<<<<<<<<<<<
21069  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
21070  *
21071  */
21072  __pyx_t_10 = __pyx_v_eN;
21073  __pyx_t_11 = __pyx_v_ebN;
21074  __pyx_t_12 = __pyx_v_k;
21075  __pyx_t_13 = 1;
21076  __pyx_t_14 = -1;
21077  if (__pyx_t_10 < 0) {
21078  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
21079  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 0;
21080  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21081  if (__pyx_t_11 < 0) {
21082  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[1].shape;
21083  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 1;
21084  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21085  if (__pyx_t_12 < 0) {
21086  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
21087  if (unlikely(__pyx_t_12 < 0)) __pyx_t_14 = 2;
21088  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21089  if (__pyx_t_13 < 0) {
21090  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[3].shape;
21091  if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 3;
21092  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21093  if (unlikely(__pyx_t_14 != -1)) {
21094  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21095  __PYX_ERR(0, 934, __pyx_L1_error)
21096  }
21097  __pyx_t_15 = __pyx_v_eN;
21098  __pyx_t_16 = __pyx_v_ebN;
21099  __pyx_t_17 = __pyx_v_k;
21100  __pyx_t_18 = 0;
21101  __pyx_t_14 = -1;
21102  if (__pyx_t_15 < 0) {
21103  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[0].shape;
21104  if (unlikely(__pyx_t_15 < 0)) __pyx_t_14 = 0;
21105  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21106  if (__pyx_t_16 < 0) {
21107  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[1].shape;
21108  if (unlikely(__pyx_t_16 < 0)) __pyx_t_14 = 1;
21109  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21110  if (__pyx_t_17 < 0) {
21111  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[2].shape;
21112  if (unlikely(__pyx_t_17 < 0)) __pyx_t_14 = 2;
21113  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21114  if (__pyx_t_18 < 0) {
21115  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[3].shape;
21116  if (unlikely(__pyx_t_18 < 0)) __pyx_t_14 = 3;
21117  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21118  if (unlikely(__pyx_t_14 != -1)) {
21119  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21120  __PYX_ERR(0, 934, __pyx_L1_error)
21121  }
21122  __pyx_t_19 = __pyx_v_eN;
21123  __pyx_t_20 = __pyx_v_ebN;
21124  __pyx_t_21 = __pyx_v_k;
21125  __pyx_t_22 = 0;
21126  __pyx_t_14 = -1;
21127  if (__pyx_t_19 < 0) {
21128  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[0].shape;
21129  if (unlikely(__pyx_t_19 < 0)) __pyx_t_14 = 0;
21130  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21131  if (__pyx_t_20 < 0) {
21132  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[1].shape;
21133  if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 1;
21134  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21135  if (__pyx_t_21 < 0) {
21136  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[2].shape;
21137  if (unlikely(__pyx_t_21 < 0)) __pyx_t_14 = 2;
21138  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21139  if (__pyx_t_22 < 0) {
21140  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[3].shape;
21141  if (unlikely(__pyx_t_22 < 0)) __pyx_t_14 = 3;
21142  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21143  if (unlikely(__pyx_t_14 != -1)) {
21144  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21145  __PYX_ERR(0, 934, __pyx_L1_error)
21146  }
21147  __pyx_t_23 = __pyx_v_eN;
21148  __pyx_t_24 = __pyx_v_ebN;
21149  __pyx_t_25 = __pyx_v_k;
21150  __pyx_t_26 = 0;
21151  __pyx_t_14 = -1;
21152  if (__pyx_t_23 < 0) {
21153  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[0].shape;
21154  if (unlikely(__pyx_t_23 < 0)) __pyx_t_14 = 0;
21155  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_14 = 0;
21156  if (__pyx_t_24 < 0) {
21157  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[1].shape;
21158  if (unlikely(__pyx_t_24 < 0)) __pyx_t_14 = 1;
21159  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_14 = 1;
21160  if (__pyx_t_25 < 0) {
21161  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[2].shape;
21162  if (unlikely(__pyx_t_25 < 0)) __pyx_t_14 = 2;
21163  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_14 = 2;
21164  if (__pyx_t_26 < 0) {
21165  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[3].shape;
21166  if (unlikely(__pyx_t_26 < 0)) __pyx_t_14 = 3;
21167  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_14 = 3;
21168  if (unlikely(__pyx_t_14 != -1)) {
21169  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21170  __PYX_ERR(0, 934, __pyx_L1_error)
21171  }
21172  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[3].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[3].strides)))));
21173 
21174  /* "subsurfaceTransportFunctions.pyx":935
21175  * for k in range(x.shape[2]):
21176  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
21177  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]); # <<<<<<<<<<<<<<
21178  *
21179  *
21180  */
21181  __pyx_t_27 = __pyx_v_eN;
21182  __pyx_t_28 = __pyx_v_ebN;
21183  __pyx_t_29 = __pyx_v_k;
21184  __pyx_t_30 = 0;
21185  __pyx_t_14 = -1;
21186  if (__pyx_t_27 < 0) {
21187  __pyx_t_27 += __pyx_pybuffernd_x.diminfo[0].shape;
21188  if (unlikely(__pyx_t_27 < 0)) __pyx_t_14 = 0;
21189  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21190  if (__pyx_t_28 < 0) {
21191  __pyx_t_28 += __pyx_pybuffernd_x.diminfo[1].shape;
21192  if (unlikely(__pyx_t_28 < 0)) __pyx_t_14 = 1;
21193  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21194  if (__pyx_t_29 < 0) {
21195  __pyx_t_29 += __pyx_pybuffernd_x.diminfo[2].shape;
21196  if (unlikely(__pyx_t_29 < 0)) __pyx_t_14 = 2;
21197  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21198  if (__pyx_t_30 < 0) {
21199  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[3].shape;
21200  if (unlikely(__pyx_t_30 < 0)) __pyx_t_14 = 3;
21201  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21202  if (unlikely(__pyx_t_14 != -1)) {
21203  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21204  __PYX_ERR(0, 935, __pyx_L1_error)
21205  }
21206  __pyx_t_31 = __pyx_v_eN;
21207  __pyx_t_32 = __pyx_v_ebN;
21208  __pyx_t_33 = __pyx_v_k;
21209  __pyx_t_34 = 1;
21210  __pyx_t_14 = -1;
21211  if (__pyx_t_31 < 0) {
21212  __pyx_t_31 += __pyx_pybuffernd_x.diminfo[0].shape;
21213  if (unlikely(__pyx_t_31 < 0)) __pyx_t_14 = 0;
21214  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21215  if (__pyx_t_32 < 0) {
21216  __pyx_t_32 += __pyx_pybuffernd_x.diminfo[1].shape;
21217  if (unlikely(__pyx_t_32 < 0)) __pyx_t_14 = 1;
21218  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21219  if (__pyx_t_33 < 0) {
21220  __pyx_t_33 += __pyx_pybuffernd_x.diminfo[2].shape;
21221  if (unlikely(__pyx_t_33 < 0)) __pyx_t_14 = 2;
21222  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21223  if (__pyx_t_34 < 0) {
21224  __pyx_t_34 += __pyx_pybuffernd_x.diminfo[3].shape;
21225  if (unlikely(__pyx_t_34 < 0)) __pyx_t_14 = 3;
21226  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21227  if (unlikely(__pyx_t_14 != -1)) {
21228  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21229  __PYX_ERR(0, 935, __pyx_L1_error)
21230  }
21231  __pyx_t_35 = __pyx_v_eN;
21232  __pyx_t_36 = __pyx_v_ebN;
21233  __pyx_t_37 = __pyx_v_k;
21234  __pyx_t_38 = 1;
21235  __pyx_t_14 = -1;
21236  if (__pyx_t_35 < 0) {
21237  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[0].shape;
21238  if (unlikely(__pyx_t_35 < 0)) __pyx_t_14 = 0;
21239  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21240  if (__pyx_t_36 < 0) {
21241  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[1].shape;
21242  if (unlikely(__pyx_t_36 < 0)) __pyx_t_14 = 1;
21243  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21244  if (__pyx_t_37 < 0) {
21245  __pyx_t_37 += __pyx_pybuffernd_x.diminfo[2].shape;
21246  if (unlikely(__pyx_t_37 < 0)) __pyx_t_14 = 2;
21247  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21248  if (__pyx_t_38 < 0) {
21249  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[3].shape;
21250  if (unlikely(__pyx_t_38 < 0)) __pyx_t_14 = 3;
21251  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21252  if (unlikely(__pyx_t_14 != -1)) {
21253  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21254  __PYX_ERR(0, 935, __pyx_L1_error)
21255  }
21256  __pyx_t_39 = __pyx_v_eN;
21257  __pyx_t_40 = __pyx_v_ebN;
21258  __pyx_t_41 = __pyx_v_k;
21259  __pyx_t_42 = 1;
21260  __pyx_t_14 = -1;
21261  if (__pyx_t_39 < 0) {
21262  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[0].shape;
21263  if (unlikely(__pyx_t_39 < 0)) __pyx_t_14 = 0;
21264  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_14 = 0;
21265  if (__pyx_t_40 < 0) {
21266  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[1].shape;
21267  if (unlikely(__pyx_t_40 < 0)) __pyx_t_14 = 1;
21268  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_14 = 1;
21269  if (__pyx_t_41 < 0) {
21270  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[2].shape;
21271  if (unlikely(__pyx_t_41 < 0)) __pyx_t_14 = 2;
21272  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_14 = 2;
21273  if (__pyx_t_42 < 0) {
21274  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[3].shape;
21275  if (unlikely(__pyx_t_42 < 0)) __pyx_t_14 = 3;
21276  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_14 = 3;
21277  if (unlikely(__pyx_t_14 != -1)) {
21278  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21279  __PYX_ERR(0, 935, __pyx_L1_error)
21280  }
21281  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_42, __pyx_pybuffernd_v.diminfo[3].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_29, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_30, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_34, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_37, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_38, __pyx_pybuffernd_x.diminfo[3].strides)))));
21282  }
21283  }
21284  }
21285 
21286  /* "subsurfaceTransportFunctions.pyx":924
21287  *
21288  *
21289  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
21290  * numpy.ndarray[DTYPE_t,ndim=4] x,
21291  * numpy.ndarray[DTYPE_t,ndim=4] v):
21292  */
21293 
21294  /* function exit code */
21295  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21296  goto __pyx_L0;
21297  __pyx_L1_error:;
21298  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
21299  __Pyx_PyThreadState_declare
21300  __Pyx_PyThreadState_assign
21301  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
21302  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
21303  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
21304  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
21305  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
21306  __pyx_r = NULL;
21307  goto __pyx_L2;
21308  __pyx_L0:;
21309  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
21310  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
21311  __pyx_L2:;
21312  __Pyx_XGIVEREF(__pyx_r);
21313  __Pyx_RefNannyFinishContext();
21314  return __pyx_r;
21315 }
21316 
21317 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":215
21318  * # experimental exception made for __getbuffer__ and __releasebuffer__
21319  * # -- the details of this may change.
21320  * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
21321  * # This implementation of getbuffer is geared towards Cython
21322  * # requirements, and does not yet fulfill the PEP.
21323  */
21324 
21325 /* Python wrapper */
21326 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
21327 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
21328  int __pyx_r;
21329  __Pyx_RefNannyDeclarations
21330  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
21331  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
21332 
21333  /* function exit code */
21334  __Pyx_RefNannyFinishContext();
21335  return __pyx_r;
21336 }
21337 
21338 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
21339  int __pyx_v_i;
21340  int __pyx_v_ndim;
21341  int __pyx_v_endian_detector;
21342  int __pyx_v_little_endian;
21343  int __pyx_v_t;
21344  char *__pyx_v_f;
21345  PyArray_Descr *__pyx_v_descr = 0;
21346  int __pyx_v_offset;
21347  int __pyx_r;
21348  __Pyx_RefNannyDeclarations
21349  int __pyx_t_1;
21350  int __pyx_t_2;
21351  PyObject *__pyx_t_3 = NULL;
21352  int __pyx_t_4;
21353  int __pyx_t_5;
21354  int __pyx_t_6;
21355  PyObject *__pyx_t_7 = NULL;
21356  char *__pyx_t_8;
21357  if (__pyx_v_info == NULL) {
21358  PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
21359  return -1;
21360  }
21361  __Pyx_RefNannySetupContext("__getbuffer__", 0);
21362  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
21363  __Pyx_GIVEREF(__pyx_v_info->obj);
21364 
21365  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
21366  *
21367  * cdef int i, ndim
21368  * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
21369  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
21370  *
21371  */
21372  __pyx_v_endian_detector = 1;
21373 
21374  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":223
21375  * cdef int i, ndim
21376  * cdef int endian_detector = 1
21377  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
21378  *
21379  * ndim = PyArray_NDIM(self)
21380  */
21381  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
21382 
21383  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225
21384  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
21385  *
21386  * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
21387  *
21388  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
21389  */
21390  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
21391 
21392  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":227
21393  * ndim = PyArray_NDIM(self)
21394  *
21395  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
21396  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
21397  * raise ValueError(u"ndarray is not C contiguous")
21398  */
21399  __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
21400  if (__pyx_t_2) {
21401  } else {
21402  __pyx_t_1 = __pyx_t_2;
21403  goto __pyx_L4_bool_binop_done;
21404  }
21405 
21406  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":228
21407  *
21408  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
21409  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
21410  * raise ValueError(u"ndarray is not C contiguous")
21411  *
21412  */
21413  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
21414  __pyx_t_1 = __pyx_t_2;
21415  __pyx_L4_bool_binop_done:;
21416 
21417  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":227
21418  * ndim = PyArray_NDIM(self)
21419  *
21420  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
21421  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
21422  * raise ValueError(u"ndarray is not C contiguous")
21423  */
21424  if (unlikely(__pyx_t_1)) {
21425 
21426  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229
21427  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
21428  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
21429  * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
21430  *
21431  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
21432  */
21433  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 229, __pyx_L1_error)
21434  __Pyx_GOTREF(__pyx_t_3);
21435  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21436  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21437  __PYX_ERR(1, 229, __pyx_L1_error)
21438 
21439  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":227
21440  * ndim = PyArray_NDIM(self)
21441  *
21442  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
21443  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
21444  * raise ValueError(u"ndarray is not C contiguous")
21445  */
21446  }
21447 
21448  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231
21449  * raise ValueError(u"ndarray is not C contiguous")
21450  *
21451  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
21452  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
21453  * raise ValueError(u"ndarray is not Fortran contiguous")
21454  */
21455  __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
21456  if (__pyx_t_2) {
21457  } else {
21458  __pyx_t_1 = __pyx_t_2;
21459  goto __pyx_L7_bool_binop_done;
21460  }
21461 
21462  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":232
21463  *
21464  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
21465  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
21466  * raise ValueError(u"ndarray is not Fortran contiguous")
21467  *
21468  */
21469  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
21470  __pyx_t_1 = __pyx_t_2;
21471  __pyx_L7_bool_binop_done:;
21472 
21473  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231
21474  * raise ValueError(u"ndarray is not C contiguous")
21475  *
21476  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
21477  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
21478  * raise ValueError(u"ndarray is not Fortran contiguous")
21479  */
21480  if (unlikely(__pyx_t_1)) {
21481 
21482  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233
21483  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
21484  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
21485  * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
21486  *
21487  * info.buf = PyArray_DATA(self)
21488  */
21489  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 233, __pyx_L1_error)
21490  __Pyx_GOTREF(__pyx_t_3);
21491  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21492  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21493  __PYX_ERR(1, 233, __pyx_L1_error)
21494 
21495  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231
21496  * raise ValueError(u"ndarray is not C contiguous")
21497  *
21498  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
21499  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
21500  * raise ValueError(u"ndarray is not Fortran contiguous")
21501  */
21502  }
21503 
21504  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235
21505  * raise ValueError(u"ndarray is not Fortran contiguous")
21506  *
21507  * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
21508  * info.ndim = ndim
21509  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
21510  */
21511  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
21512 
21513  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236
21514  *
21515  * info.buf = PyArray_DATA(self)
21516  * info.ndim = ndim # <<<<<<<<<<<<<<
21517  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
21518  * # Allocate new buffer for strides and shape info.
21519  */
21520  __pyx_v_info->ndim = __pyx_v_ndim;
21521 
21522  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237
21523  * info.buf = PyArray_DATA(self)
21524  * info.ndim = ndim
21525  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
21526  * # Allocate new buffer for strides and shape info.
21527  * # This is allocated as one block, strides first.
21528  */
21529  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
21530  if (__pyx_t_1) {
21531 
21532  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":240
21533  * # Allocate new buffer for strides and shape info.
21534  * # This is allocated as one block, strides first.
21535  * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim) # <<<<<<<<<<<<<<
21536  * info.shape = info.strides + ndim
21537  * for i in range(ndim):
21538  */
21539  __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
21540 
21541  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":241
21542  * # This is allocated as one block, strides first.
21543  * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
21544  * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
21545  * for i in range(ndim):
21546  * info.strides[i] = PyArray_STRIDES(self)[i]
21547  */
21548  __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
21549 
21550  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242
21551  * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
21552  * info.shape = info.strides + ndim
21553  * for i in range(ndim): # <<<<<<<<<<<<<<
21554  * info.strides[i] = PyArray_STRIDES(self)[i]
21555  * info.shape[i] = PyArray_DIMS(self)[i]
21556  */
21557  __pyx_t_4 = __pyx_v_ndim;
21558  __pyx_t_5 = __pyx_t_4;
21559  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21560  __pyx_v_i = __pyx_t_6;
21561 
21562  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243
21563  * info.shape = info.strides + ndim
21564  * for i in range(ndim):
21565  * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
21566  * info.shape[i] = PyArray_DIMS(self)[i]
21567  * else:
21568  */
21569  (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
21570 
21571  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":244
21572  * for i in range(ndim):
21573  * info.strides[i] = PyArray_STRIDES(self)[i]
21574  * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
21575  * else:
21576  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
21577  */
21578  (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
21579  }
21580 
21581  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237
21582  * info.buf = PyArray_DATA(self)
21583  * info.ndim = ndim
21584  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
21585  * # Allocate new buffer for strides and shape info.
21586  * # This is allocated as one block, strides first.
21587  */
21588  goto __pyx_L9;
21589  }
21590 
21591  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":246
21592  * info.shape[i] = PyArray_DIMS(self)[i]
21593  * else:
21594  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
21595  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
21596  * info.suboffsets = NULL
21597  */
21598  /*else*/ {
21599  __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
21600 
21601  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":247
21602  * else:
21603  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
21604  * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
21605  * info.suboffsets = NULL
21606  * info.itemsize = PyArray_ITEMSIZE(self)
21607  */
21608  __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
21609  }
21610  __pyx_L9:;
21611 
21612  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
21613  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
21614  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
21615  * info.suboffsets = NULL # <<<<<<<<<<<<<<
21616  * info.itemsize = PyArray_ITEMSIZE(self)
21617  * info.readonly = not PyArray_ISWRITEABLE(self)
21618  */
21619  __pyx_v_info->suboffsets = NULL;
21620 
21621  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":249
21622  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
21623  * info.suboffsets = NULL
21624  * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
21625  * info.readonly = not PyArray_ISWRITEABLE(self)
21626  *
21627  */
21628  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
21629 
21630  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":250
21631  * info.suboffsets = NULL
21632  * info.itemsize = PyArray_ITEMSIZE(self)
21633  * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
21634  *
21635  * cdef int t
21636  */
21637  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
21638 
21639  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":253
21640  *
21641  * cdef int t
21642  * cdef char* f = NULL # <<<<<<<<<<<<<<
21643  * cdef dtype descr = self.descr
21644  * cdef int offset
21645  */
21646  __pyx_v_f = NULL;
21647 
21648  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":254
21649  * cdef int t
21650  * cdef char* f = NULL
21651  * cdef dtype descr = self.descr # <<<<<<<<<<<<<<
21652  * cdef int offset
21653  *
21654  */
21655  __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
21656  __Pyx_INCREF(__pyx_t_3);
21657  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
21658  __pyx_t_3 = 0;
21659 
21660  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
21661  * cdef int offset
21662  *
21663  * info.obj = self # <<<<<<<<<<<<<<
21664  *
21665  * if not PyDataType_HASFIELDS(descr):
21666  */
21667  __Pyx_INCREF(((PyObject *)__pyx_v_self));
21668  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
21669  __Pyx_GOTREF(__pyx_v_info->obj);
21670  __Pyx_DECREF(__pyx_v_info->obj);
21671  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
21672 
21673  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
21674  * info.obj = self
21675  *
21676  * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
21677  * t = descr.type_num
21678  * if ((descr.byteorder == c'>' and little_endian) or
21679  */
21680  __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
21681  if (__pyx_t_1) {
21682 
21683  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260
21684  *
21685  * if not PyDataType_HASFIELDS(descr):
21686  * t = descr.type_num # <<<<<<<<<<<<<<
21687  * if ((descr.byteorder == c'>' and little_endian) or
21688  * (descr.byteorder == c'<' and not little_endian)):
21689  */
21690  __pyx_t_4 = __pyx_v_descr->type_num;
21691  __pyx_v_t = __pyx_t_4;
21692 
21693  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261
21694  * if not PyDataType_HASFIELDS(descr):
21695  * t = descr.type_num
21696  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21697  * (descr.byteorder == c'<' and not little_endian)):
21698  * raise ValueError(u"Non-native byte order not supported")
21699  */
21700  __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
21701  if (!__pyx_t_2) {
21702  goto __pyx_L15_next_or;
21703  } else {
21704  }
21705  __pyx_t_2 = (__pyx_v_little_endian != 0);
21706  if (!__pyx_t_2) {
21707  } else {
21708  __pyx_t_1 = __pyx_t_2;
21709  goto __pyx_L14_bool_binop_done;
21710  }
21711  __pyx_L15_next_or:;
21712 
21713  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":262
21714  * t = descr.type_num
21715  * if ((descr.byteorder == c'>' and little_endian) or
21716  * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
21717  * raise ValueError(u"Non-native byte order not supported")
21718  * if t == NPY_BYTE: f = "b"
21719  */
21720  __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
21721  if (__pyx_t_2) {
21722  } else {
21723  __pyx_t_1 = __pyx_t_2;
21724  goto __pyx_L14_bool_binop_done;
21725  }
21726  __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
21727  __pyx_t_1 = __pyx_t_2;
21728  __pyx_L14_bool_binop_done:;
21729 
21730  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261
21731  * if not PyDataType_HASFIELDS(descr):
21732  * t = descr.type_num
21733  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21734  * (descr.byteorder == c'<' and not little_endian)):
21735  * raise ValueError(u"Non-native byte order not supported")
21736  */
21737  if (unlikely(__pyx_t_1)) {
21738 
21739  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263
21740  * if ((descr.byteorder == c'>' and little_endian) or
21741  * (descr.byteorder == c'<' and not little_endian)):
21742  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
21743  * if t == NPY_BYTE: f = "b"
21744  * elif t == NPY_UBYTE: f = "B"
21745  */
21746  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 263, __pyx_L1_error)
21747  __Pyx_GOTREF(__pyx_t_3);
21748  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21749  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21750  __PYX_ERR(1, 263, __pyx_L1_error)
21751 
21752  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261
21753  * if not PyDataType_HASFIELDS(descr):
21754  * t = descr.type_num
21755  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21756  * (descr.byteorder == c'<' and not little_endian)):
21757  * raise ValueError(u"Non-native byte order not supported")
21758  */
21759  }
21760 
21761  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":264
21762  * (descr.byteorder == c'<' and not little_endian)):
21763  * raise ValueError(u"Non-native byte order not supported")
21764  * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
21765  * elif t == NPY_UBYTE: f = "B"
21766  * elif t == NPY_SHORT: f = "h"
21767  */
21768  switch (__pyx_v_t) {
21769  case NPY_BYTE:
21770  __pyx_v_f = ((char *)"b");
21771  break;
21772 
21773  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
21774  * raise ValueError(u"Non-native byte order not supported")
21775  * if t == NPY_BYTE: f = "b"
21776  * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
21777  * elif t == NPY_SHORT: f = "h"
21778  * elif t == NPY_USHORT: f = "H"
21779  */
21780  case NPY_UBYTE:
21781  __pyx_v_f = ((char *)"B");
21782  break;
21783 
21784  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
21785  * if t == NPY_BYTE: f = "b"
21786  * elif t == NPY_UBYTE: f = "B"
21787  * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
21788  * elif t == NPY_USHORT: f = "H"
21789  * elif t == NPY_INT: f = "i"
21790  */
21791  case NPY_SHORT:
21792  __pyx_v_f = ((char *)"h");
21793  break;
21794 
21795  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":267
21796  * elif t == NPY_UBYTE: f = "B"
21797  * elif t == NPY_SHORT: f = "h"
21798  * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
21799  * elif t == NPY_INT: f = "i"
21800  * elif t == NPY_UINT: f = "I"
21801  */
21802  case NPY_USHORT:
21803  __pyx_v_f = ((char *)"H");
21804  break;
21805 
21806  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
21807  * elif t == NPY_SHORT: f = "h"
21808  * elif t == NPY_USHORT: f = "H"
21809  * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
21810  * elif t == NPY_UINT: f = "I"
21811  * elif t == NPY_LONG: f = "l"
21812  */
21813  case NPY_INT:
21814  __pyx_v_f = ((char *)"i");
21815  break;
21816 
21817  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":269
21818  * elif t == NPY_USHORT: f = "H"
21819  * elif t == NPY_INT: f = "i"
21820  * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
21821  * elif t == NPY_LONG: f = "l"
21822  * elif t == NPY_ULONG: f = "L"
21823  */
21824  case NPY_UINT:
21825  __pyx_v_f = ((char *)"I");
21826  break;
21827 
21828  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
21829  * elif t == NPY_INT: f = "i"
21830  * elif t == NPY_UINT: f = "I"
21831  * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
21832  * elif t == NPY_ULONG: f = "L"
21833  * elif t == NPY_LONGLONG: f = "q"
21834  */
21835  case NPY_LONG:
21836  __pyx_v_f = ((char *)"l");
21837  break;
21838 
21839  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
21840  * elif t == NPY_UINT: f = "I"
21841  * elif t == NPY_LONG: f = "l"
21842  * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
21843  * elif t == NPY_LONGLONG: f = "q"
21844  * elif t == NPY_ULONGLONG: f = "Q"
21845  */
21846  case NPY_ULONG:
21847  __pyx_v_f = ((char *)"L");
21848  break;
21849 
21850  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
21851  * elif t == NPY_LONG: f = "l"
21852  * elif t == NPY_ULONG: f = "L"
21853  * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
21854  * elif t == NPY_ULONGLONG: f = "Q"
21855  * elif t == NPY_FLOAT: f = "f"
21856  */
21857  case NPY_LONGLONG:
21858  __pyx_v_f = ((char *)"q");
21859  break;
21860 
21861  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":273
21862  * elif t == NPY_ULONG: f = "L"
21863  * elif t == NPY_LONGLONG: f = "q"
21864  * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
21865  * elif t == NPY_FLOAT: f = "f"
21866  * elif t == NPY_DOUBLE: f = "d"
21867  */
21868  case NPY_ULONGLONG:
21869  __pyx_v_f = ((char *)"Q");
21870  break;
21871 
21872  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
21873  * elif t == NPY_LONGLONG: f = "q"
21874  * elif t == NPY_ULONGLONG: f = "Q"
21875  * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
21876  * elif t == NPY_DOUBLE: f = "d"
21877  * elif t == NPY_LONGDOUBLE: f = "g"
21878  */
21879  case NPY_FLOAT:
21880  __pyx_v_f = ((char *)"f");
21881  break;
21882 
21883  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
21884  * elif t == NPY_ULONGLONG: f = "Q"
21885  * elif t == NPY_FLOAT: f = "f"
21886  * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
21887  * elif t == NPY_LONGDOUBLE: f = "g"
21888  * elif t == NPY_CFLOAT: f = "Zf"
21889  */
21890  case NPY_DOUBLE:
21891  __pyx_v_f = ((char *)"d");
21892  break;
21893 
21894  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
21895  * elif t == NPY_FLOAT: f = "f"
21896  * elif t == NPY_DOUBLE: f = "d"
21897  * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
21898  * elif t == NPY_CFLOAT: f = "Zf"
21899  * elif t == NPY_CDOUBLE: f = "Zd"
21900  */
21901  case NPY_LONGDOUBLE:
21902  __pyx_v_f = ((char *)"g");
21903  break;
21904 
21905  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":277
21906  * elif t == NPY_DOUBLE: f = "d"
21907  * elif t == NPY_LONGDOUBLE: f = "g"
21908  * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
21909  * elif t == NPY_CDOUBLE: f = "Zd"
21910  * elif t == NPY_CLONGDOUBLE: f = "Zg"
21911  */
21912  case NPY_CFLOAT:
21913  __pyx_v_f = ((char *)"Zf");
21914  break;
21915 
21916  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
21917  * elif t == NPY_LONGDOUBLE: f = "g"
21918  * elif t == NPY_CFLOAT: f = "Zf"
21919  * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
21920  * elif t == NPY_CLONGDOUBLE: f = "Zg"
21921  * elif t == NPY_OBJECT: f = "O"
21922  */
21923  case NPY_CDOUBLE:
21924  __pyx_v_f = ((char *)"Zd");
21925  break;
21926 
21927  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
21928  * elif t == NPY_CFLOAT: f = "Zf"
21929  * elif t == NPY_CDOUBLE: f = "Zd"
21930  * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
21931  * elif t == NPY_OBJECT: f = "O"
21932  * else:
21933  */
21934  case NPY_CLONGDOUBLE:
21935  __pyx_v_f = ((char *)"Zg");
21936  break;
21937 
21938  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
21939  * elif t == NPY_CDOUBLE: f = "Zd"
21940  * elif t == NPY_CLONGDOUBLE: f = "Zg"
21941  * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
21942  * else:
21943  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
21944  */
21945  case NPY_OBJECT:
21946  __pyx_v_f = ((char *)"O");
21947  break;
21948  default:
21949 
21950  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":282
21951  * elif t == NPY_OBJECT: f = "O"
21952  * else:
21953  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
21954  * info.format = f
21955  * return
21956  */
21957  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error)
21958  __Pyx_GOTREF(__pyx_t_3);
21959  __pyx_t_7 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 282, __pyx_L1_error)
21960  __Pyx_GOTREF(__pyx_t_7);
21961  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21962  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error)
21963  __Pyx_GOTREF(__pyx_t_3);
21964  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
21965  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21966  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21967  __PYX_ERR(1, 282, __pyx_L1_error)
21968  break;
21969  }
21970 
21971  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
21972  * else:
21973  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
21974  * info.format = f # <<<<<<<<<<<<<<
21975  * return
21976  * else:
21977  */
21978  __pyx_v_info->format = __pyx_v_f;
21979 
21980  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
21981  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
21982  * info.format = f
21983  * return # <<<<<<<<<<<<<<
21984  * else:
21985  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
21986  */
21987  __pyx_r = 0;
21988  goto __pyx_L0;
21989 
21990  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
21991  * info.obj = self
21992  *
21993  * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
21994  * t = descr.type_num
21995  * if ((descr.byteorder == c'>' and little_endian) or
21996  */
21997  }
21998 
21999  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":286
22000  * return
22001  * else:
22002  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
22003  * info.format[0] = c'^' # Native data types, manual alignment
22004  * offset = 0
22005  */
22006  /*else*/ {
22007  __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
22008 
22009  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":287
22010  * else:
22011  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
22012  * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
22013  * offset = 0
22014  * f = _util_dtypestring(descr, info.format + 1,
22015  */
22016  (__pyx_v_info->format[0]) = '^';
22017 
22018  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":288
22019  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
22020  * info.format[0] = c'^' # Native data types, manual alignment
22021  * offset = 0 # <<<<<<<<<<<<<<
22022  * f = _util_dtypestring(descr, info.format + 1,
22023  * info.format + _buffer_format_string_len,
22024  */
22025  __pyx_v_offset = 0;
22026 
22027  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":289
22028  * info.format[0] = c'^' # Native data types, manual alignment
22029  * offset = 0
22030  * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
22031  * info.format + _buffer_format_string_len,
22032  * &offset)
22033  */
22034  __pyx_t_8 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_8 == ((char *)NULL))) __PYX_ERR(1, 289, __pyx_L1_error)
22035  __pyx_v_f = __pyx_t_8;
22036 
22037  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
22038  * info.format + _buffer_format_string_len,
22039  * &offset)
22040  * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
22041  *
22042  * def __releasebuffer__(ndarray self, Py_buffer* info):
22043  */
22044  (__pyx_v_f[0]) = '\x00';
22045  }
22046 
22047  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":215
22048  * # experimental exception made for __getbuffer__ and __releasebuffer__
22049  * # -- the details of this may change.
22050  * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
22051  * # This implementation of getbuffer is geared towards Cython
22052  * # requirements, and does not yet fulfill the PEP.
22053  */
22054 
22055  /* function exit code */
22056  __pyx_r = 0;
22057  goto __pyx_L0;
22058  __pyx_L1_error:;
22059  __Pyx_XDECREF(__pyx_t_3);
22060  __Pyx_XDECREF(__pyx_t_7);
22061  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22062  __pyx_r = -1;
22063  if (__pyx_v_info->obj != NULL) {
22064  __Pyx_GOTREF(__pyx_v_info->obj);
22065  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
22066  }
22067  goto __pyx_L2;
22068  __pyx_L0:;
22069  if (__pyx_v_info->obj == Py_None) {
22070  __Pyx_GOTREF(__pyx_v_info->obj);
22071  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
22072  }
22073  __pyx_L2:;
22074  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
22075  __Pyx_RefNannyFinishContext();
22076  return __pyx_r;
22077 }
22078 
22079 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294
22080  * f[0] = c'\0' # Terminate format string
22081  *
22082  * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
22083  * if PyArray_HASFIELDS(self):
22084  * PyObject_Free(info.format)
22085  */
22086 
22087 /* Python wrapper */
22088 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
22089 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
22090  __Pyx_RefNannyDeclarations
22091  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
22092  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
22093 
22094  /* function exit code */
22095  __Pyx_RefNannyFinishContext();
22096 }
22097 
22098 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
22099  __Pyx_RefNannyDeclarations
22100  int __pyx_t_1;
22101  __Pyx_RefNannySetupContext("__releasebuffer__", 0);
22102 
22103  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":295
22104  *
22105  * def __releasebuffer__(ndarray self, Py_buffer* info):
22106  * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
22107  * PyObject_Free(info.format)
22108  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
22109  */
22110  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
22111  if (__pyx_t_1) {
22112 
22113  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":296
22114  * def __releasebuffer__(ndarray self, Py_buffer* info):
22115  * if PyArray_HASFIELDS(self):
22116  * PyObject_Free(info.format) # <<<<<<<<<<<<<<
22117  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
22118  * PyObject_Free(info.strides)
22119  */
22120  PyObject_Free(__pyx_v_info->format);
22121 
22122  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":295
22123  *
22124  * def __releasebuffer__(ndarray self, Py_buffer* info):
22125  * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
22126  * PyObject_Free(info.format)
22127  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
22128  */
22129  }
22130 
22131  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":297
22132  * if PyArray_HASFIELDS(self):
22133  * PyObject_Free(info.format)
22134  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
22135  * PyObject_Free(info.strides)
22136  * # info.shape was stored after info.strides in the same block
22137  */
22138  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
22139  if (__pyx_t_1) {
22140 
22141  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":298
22142  * PyObject_Free(info.format)
22143  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
22144  * PyObject_Free(info.strides) # <<<<<<<<<<<<<<
22145  * # info.shape was stored after info.strides in the same block
22146  *
22147  */
22148  PyObject_Free(__pyx_v_info->strides);
22149 
22150  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":297
22151  * if PyArray_HASFIELDS(self):
22152  * PyObject_Free(info.format)
22153  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
22154  * PyObject_Free(info.strides)
22155  * # info.shape was stored after info.strides in the same block
22156  */
22157  }
22158 
22159  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294
22160  * f[0] = c'\0' # Terminate format string
22161  *
22162  * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
22163  * if PyArray_HASFIELDS(self):
22164  * PyObject_Free(info.format)
22165  */
22166 
22167  /* function exit code */
22168  __Pyx_RefNannyFinishContext();
22169 }
22170 
22171 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":775
22172  * ctypedef npy_cdouble complex_t
22173  *
22174  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
22175  * return PyArray_MultiIterNew(1, <void*>a)
22176  *
22177  */
22178 
22179 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
22180  PyObject *__pyx_r = NULL;
22181  __Pyx_RefNannyDeclarations
22182  PyObject *__pyx_t_1 = NULL;
22183  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
22184 
22185  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
22186  *
22187  * cdef inline object PyArray_MultiIterNew1(a):
22188  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
22189  *
22190  * cdef inline object PyArray_MultiIterNew2(a, b):
22191  */
22192  __Pyx_XDECREF(__pyx_r);
22193  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 776, __pyx_L1_error)
22194  __Pyx_GOTREF(__pyx_t_1);
22195  __pyx_r = __pyx_t_1;
22196  __pyx_t_1 = 0;
22197  goto __pyx_L0;
22198 
22199  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":775
22200  * ctypedef npy_cdouble complex_t
22201  *
22202  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
22203  * return PyArray_MultiIterNew(1, <void*>a)
22204  *
22205  */
22206 
22207  /* function exit code */
22208  __pyx_L1_error:;
22209  __Pyx_XDECREF(__pyx_t_1);
22210  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
22211  __pyx_r = 0;
22212  __pyx_L0:;
22213  __Pyx_XGIVEREF(__pyx_r);
22214  __Pyx_RefNannyFinishContext();
22215  return __pyx_r;
22216 }
22217 
22218 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":778
22219  * return PyArray_MultiIterNew(1, <void*>a)
22220  *
22221  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
22222  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
22223  *
22224  */
22225 
22226 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
22227  PyObject *__pyx_r = NULL;
22228  __Pyx_RefNannyDeclarations
22229  PyObject *__pyx_t_1 = NULL;
22230  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
22231 
22232  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
22233  *
22234  * cdef inline object PyArray_MultiIterNew2(a, b):
22235  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
22236  *
22237  * cdef inline object PyArray_MultiIterNew3(a, b, c):
22238  */
22239  __Pyx_XDECREF(__pyx_r);
22240  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 779, __pyx_L1_error)
22241  __Pyx_GOTREF(__pyx_t_1);
22242  __pyx_r = __pyx_t_1;
22243  __pyx_t_1 = 0;
22244  goto __pyx_L0;
22245 
22246  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":778
22247  * return PyArray_MultiIterNew(1, <void*>a)
22248  *
22249  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
22250  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
22251  *
22252  */
22253 
22254  /* function exit code */
22255  __pyx_L1_error:;
22256  __Pyx_XDECREF(__pyx_t_1);
22257  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
22258  __pyx_r = 0;
22259  __pyx_L0:;
22260  __Pyx_XGIVEREF(__pyx_r);
22261  __Pyx_RefNannyFinishContext();
22262  return __pyx_r;
22263 }
22264 
22265 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":781
22266  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
22267  *
22268  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
22269  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
22270  *
22271  */
22272 
22273 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
22274  PyObject *__pyx_r = NULL;
22275  __Pyx_RefNannyDeclarations
22276  PyObject *__pyx_t_1 = NULL;
22277  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
22278 
22279  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782
22280  *
22281  * cdef inline object PyArray_MultiIterNew3(a, b, c):
22282  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
22283  *
22284  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
22285  */
22286  __Pyx_XDECREF(__pyx_r);
22287  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 782, __pyx_L1_error)
22288  __Pyx_GOTREF(__pyx_t_1);
22289  __pyx_r = __pyx_t_1;
22290  __pyx_t_1 = 0;
22291  goto __pyx_L0;
22292 
22293  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":781
22294  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
22295  *
22296  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
22297  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
22298  *
22299  */
22300 
22301  /* function exit code */
22302  __pyx_L1_error:;
22303  __Pyx_XDECREF(__pyx_t_1);
22304  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
22305  __pyx_r = 0;
22306  __pyx_L0:;
22307  __Pyx_XGIVEREF(__pyx_r);
22308  __Pyx_RefNannyFinishContext();
22309  return __pyx_r;
22310 }
22311 
22312 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":784
22313  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
22314  *
22315  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
22316  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
22317  *
22318  */
22319 
22320 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
22321  PyObject *__pyx_r = NULL;
22322  __Pyx_RefNannyDeclarations
22323  PyObject *__pyx_t_1 = NULL;
22324  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
22325 
22326  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
22327  *
22328  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
22329  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
22330  *
22331  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
22332  */
22333  __Pyx_XDECREF(__pyx_r);
22334  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 785, __pyx_L1_error)
22335  __Pyx_GOTREF(__pyx_t_1);
22336  __pyx_r = __pyx_t_1;
22337  __pyx_t_1 = 0;
22338  goto __pyx_L0;
22339 
22340  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":784
22341  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
22342  *
22343  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
22344  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
22345  *
22346  */
22347 
22348  /* function exit code */
22349  __pyx_L1_error:;
22350  __Pyx_XDECREF(__pyx_t_1);
22351  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
22352  __pyx_r = 0;
22353  __pyx_L0:;
22354  __Pyx_XGIVEREF(__pyx_r);
22355  __Pyx_RefNannyFinishContext();
22356  return __pyx_r;
22357 }
22358 
22359 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":787
22360  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
22361  *
22362  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
22363  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
22364  *
22365  */
22366 
22367 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
22368  PyObject *__pyx_r = NULL;
22369  __Pyx_RefNannyDeclarations
22370  PyObject *__pyx_t_1 = NULL;
22371  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
22372 
22373  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":788
22374  *
22375  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
22376  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
22377  *
22378  * cdef inline tuple PyDataType_SHAPE(dtype d):
22379  */
22380  __Pyx_XDECREF(__pyx_r);
22381  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 788, __pyx_L1_error)
22382  __Pyx_GOTREF(__pyx_t_1);
22383  __pyx_r = __pyx_t_1;
22384  __pyx_t_1 = 0;
22385  goto __pyx_L0;
22386 
22387  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":787
22388  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
22389  *
22390  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
22391  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
22392  *
22393  */
22394 
22395  /* function exit code */
22396  __pyx_L1_error:;
22397  __Pyx_XDECREF(__pyx_t_1);
22398  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
22399  __pyx_r = 0;
22400  __pyx_L0:;
22401  __Pyx_XGIVEREF(__pyx_r);
22402  __Pyx_RefNannyFinishContext();
22403  return __pyx_r;
22404 }
22405 
22406 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
22407  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
22408  *
22409  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
22410  * if PyDataType_HASSUBARRAY(d):
22411  * return <tuple>d.subarray.shape
22412  */
22413 
22414 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
22415  PyObject *__pyx_r = NULL;
22416  __Pyx_RefNannyDeclarations
22417  int __pyx_t_1;
22418  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
22419 
22420  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
22421  *
22422  * cdef inline tuple PyDataType_SHAPE(dtype d):
22423  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
22424  * return <tuple>d.subarray.shape
22425  * else:
22426  */
22427  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
22428  if (__pyx_t_1) {
22429 
22430  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":792
22431  * cdef inline tuple PyDataType_SHAPE(dtype d):
22432  * if PyDataType_HASSUBARRAY(d):
22433  * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
22434  * else:
22435  * return ()
22436  */
22437  __Pyx_XDECREF(__pyx_r);
22438  __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
22439  __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
22440  goto __pyx_L0;
22441 
22442  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
22443  *
22444  * cdef inline tuple PyDataType_SHAPE(dtype d):
22445  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
22446  * return <tuple>d.subarray.shape
22447  * else:
22448  */
22449  }
22450 
22451  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
22452  * return <tuple>d.subarray.shape
22453  * else:
22454  * return () # <<<<<<<<<<<<<<
22455  *
22456  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
22457  */
22458  /*else*/ {
22459  __Pyx_XDECREF(__pyx_r);
22460  __Pyx_INCREF(__pyx_empty_tuple);
22461  __pyx_r = __pyx_empty_tuple;
22462  goto __pyx_L0;
22463  }
22464 
22465  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
22466  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
22467  *
22468  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
22469  * if PyDataType_HASSUBARRAY(d):
22470  * return <tuple>d.subarray.shape
22471  */
22472 
22473  /* function exit code */
22474  __pyx_L0:;
22475  __Pyx_XGIVEREF(__pyx_r);
22476  __Pyx_RefNannyFinishContext();
22477  return __pyx_r;
22478 }
22479 
22480 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":796
22481  * return ()
22482  *
22483  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
22484  * # Recursive utility function used in __getbuffer__ to get format
22485  * # string. The new location in the format string is returned.
22486  */
22487 
22488 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
22489  PyArray_Descr *__pyx_v_child = 0;
22490  int __pyx_v_endian_detector;
22491  int __pyx_v_little_endian;
22492  PyObject *__pyx_v_fields = 0;
22493  PyObject *__pyx_v_childname = NULL;
22494  PyObject *__pyx_v_new_offset = NULL;
22495  PyObject *__pyx_v_t = NULL;
22496  char *__pyx_r;
22497  __Pyx_RefNannyDeclarations
22498  PyObject *__pyx_t_1 = NULL;
22499  Py_ssize_t __pyx_t_2;
22500  PyObject *__pyx_t_3 = NULL;
22501  PyObject *__pyx_t_4 = NULL;
22502  int __pyx_t_5;
22503  int __pyx_t_6;
22504  int __pyx_t_7;
22505  long __pyx_t_8;
22506  char *__pyx_t_9;
22507  __Pyx_RefNannySetupContext("_util_dtypestring", 0);
22508 
22509  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
22510  *
22511  * cdef dtype child
22512  * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
22513  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
22514  * cdef tuple fields
22515  */
22516  __pyx_v_endian_detector = 1;
22517 
22518  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
22519  * cdef dtype child
22520  * cdef int endian_detector = 1
22521  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
22522  * cdef tuple fields
22523  *
22524  */
22525  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
22526 
22527  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":805
22528  * cdef tuple fields
22529  *
22530  * for childname in descr.names: # <<<<<<<<<<<<<<
22531  * fields = descr.fields[childname]
22532  * child, new_offset = fields
22533  */
22534  if (unlikely(__pyx_v_descr->names == Py_None)) {
22535  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
22536  __PYX_ERR(1, 805, __pyx_L1_error)
22537  }
22538  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
22539  for (;;) {
22540  if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
22541  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22542  __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 805, __pyx_L1_error)
22543  #else
22544  __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 805, __pyx_L1_error)
22545  __Pyx_GOTREF(__pyx_t_3);
22546  #endif
22547  __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
22548  __pyx_t_3 = 0;
22549 
22550  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":806
22551  *
22552  * for childname in descr.names:
22553  * fields = descr.fields[childname] # <<<<<<<<<<<<<<
22554  * child, new_offset = fields
22555  *
22556  */
22557  if (unlikely(__pyx_v_descr->fields == Py_None)) {
22558  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
22559  __PYX_ERR(1, 806, __pyx_L1_error)
22560  }
22561  __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 806, __pyx_L1_error)
22562  __Pyx_GOTREF(__pyx_t_3);
22563  if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 806, __pyx_L1_error)
22564  __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
22565  __pyx_t_3 = 0;
22566 
22567  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":807
22568  * for childname in descr.names:
22569  * fields = descr.fields[childname]
22570  * child, new_offset = fields # <<<<<<<<<<<<<<
22571  *
22572  * if (end - f) - <int>(new_offset - offset[0]) < 15:
22573  */
22574  if (likely(__pyx_v_fields != Py_None)) {
22575  PyObject* sequence = __pyx_v_fields;
22576  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
22577  if (unlikely(size != 2)) {
22578  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
22579  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
22580  __PYX_ERR(1, 807, __pyx_L1_error)
22581  }
22582  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22583  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
22584  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
22585  __Pyx_INCREF(__pyx_t_3);
22586  __Pyx_INCREF(__pyx_t_4);
22587  #else
22588  __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 807, __pyx_L1_error)
22589  __Pyx_GOTREF(__pyx_t_3);
22590  __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 807, __pyx_L1_error)
22591  __Pyx_GOTREF(__pyx_t_4);
22592  #endif
22593  } else {
22594  __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 807, __pyx_L1_error)
22595  }
22596  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 807, __pyx_L1_error)
22597  __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
22598  __pyx_t_3 = 0;
22599  __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
22600  __pyx_t_4 = 0;
22601 
22602  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":809
22603  * child, new_offset = fields
22604  *
22605  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
22606  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
22607  *
22608  */
22609  __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 809, __pyx_L1_error)
22610  __Pyx_GOTREF(__pyx_t_4);
22611  __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 809, __pyx_L1_error)
22612  __Pyx_GOTREF(__pyx_t_3);
22613  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22614  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 809, __pyx_L1_error)
22615  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22616  __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
22617  if (unlikely(__pyx_t_6)) {
22618 
22619  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":810
22620  *
22621  * if (end - f) - <int>(new_offset - offset[0]) < 15:
22622  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
22623  *
22624  * if ((child.byteorder == c'>' and little_endian) or
22625  */
22626  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 810, __pyx_L1_error)
22627  __Pyx_GOTREF(__pyx_t_3);
22628  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
22629  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22630  __PYX_ERR(1, 810, __pyx_L1_error)
22631 
22632  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":809
22633  * child, new_offset = fields
22634  *
22635  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
22636  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
22637  *
22638  */
22639  }
22640 
22641  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":812
22642  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
22643  *
22644  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
22645  * (child.byteorder == c'<' and not little_endian)):
22646  * raise ValueError(u"Non-native byte order not supported")
22647  */
22648  __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
22649  if (!__pyx_t_7) {
22650  goto __pyx_L8_next_or;
22651  } else {
22652  }
22653  __pyx_t_7 = (__pyx_v_little_endian != 0);
22654  if (!__pyx_t_7) {
22655  } else {
22656  __pyx_t_6 = __pyx_t_7;
22657  goto __pyx_L7_bool_binop_done;
22658  }
22659  __pyx_L8_next_or:;
22660 
22661  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
22662  *
22663  * if ((child.byteorder == c'>' and little_endian) or
22664  * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
22665  * raise ValueError(u"Non-native byte order not supported")
22666  * # One could encode it in the format string and have Cython
22667  */
22668  __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
22669  if (__pyx_t_7) {
22670  } else {
22671  __pyx_t_6 = __pyx_t_7;
22672  goto __pyx_L7_bool_binop_done;
22673  }
22674  __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
22675  __pyx_t_6 = __pyx_t_7;
22676  __pyx_L7_bool_binop_done:;
22677 
22678  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":812
22679  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
22680  *
22681  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
22682  * (child.byteorder == c'<' and not little_endian)):
22683  * raise ValueError(u"Non-native byte order not supported")
22684  */
22685  if (unlikely(__pyx_t_6)) {
22686 
22687  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":814
22688  * if ((child.byteorder == c'>' and little_endian) or
22689  * (child.byteorder == c'<' and not little_endian)):
22690  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
22691  * # One could encode it in the format string and have Cython
22692  * # complain instead, BUT: < and > in format strings also imply
22693  */
22694  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 814, __pyx_L1_error)
22695  __Pyx_GOTREF(__pyx_t_3);
22696  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
22697  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22698  __PYX_ERR(1, 814, __pyx_L1_error)
22699 
22700  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":812
22701  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
22702  *
22703  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
22704  * (child.byteorder == c'<' and not little_endian)):
22705  * raise ValueError(u"Non-native byte order not supported")
22706  */
22707  }
22708 
22709  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
22710  *
22711  * # Output padding bytes
22712  * while offset[0] < new_offset: # <<<<<<<<<<<<<<
22713  * f[0] = 120 # "x"; pad byte
22714  * f += 1
22715  */
22716  while (1) {
22717  __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 824, __pyx_L1_error)
22718  __Pyx_GOTREF(__pyx_t_3);
22719  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 824, __pyx_L1_error)
22720  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22721  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 824, __pyx_L1_error)
22722  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22723  if (!__pyx_t_6) break;
22724 
22725  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":825
22726  * # Output padding bytes
22727  * while offset[0] < new_offset:
22728  * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
22729  * f += 1
22730  * offset[0] += 1
22731  */
22732  (__pyx_v_f[0]) = 0x78;
22733 
22734  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826
22735  * while offset[0] < new_offset:
22736  * f[0] = 120 # "x"; pad byte
22737  * f += 1 # <<<<<<<<<<<<<<
22738  * offset[0] += 1
22739  *
22740  */
22741  __pyx_v_f = (__pyx_v_f + 1);
22742 
22743  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
22744  * f[0] = 120 # "x"; pad byte
22745  * f += 1
22746  * offset[0] += 1 # <<<<<<<<<<<<<<
22747  *
22748  * offset[0] += child.itemsize
22749  */
22750  __pyx_t_8 = 0;
22751  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
22752  }
22753 
22754  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":829
22755  * offset[0] += 1
22756  *
22757  * offset[0] += child.itemsize # <<<<<<<<<<<<<<
22758  *
22759  * if not PyDataType_HASFIELDS(child):
22760  */
22761  __pyx_t_8 = 0;
22762  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
22763 
22764  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
22765  * offset[0] += child.itemsize
22766  *
22767  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
22768  * t = child.type_num
22769  * if end - f < 5:
22770  */
22771  __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
22772  if (__pyx_t_6) {
22773 
22774  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":832
22775  *
22776  * if not PyDataType_HASFIELDS(child):
22777  * t = child.type_num # <<<<<<<<<<<<<<
22778  * if end - f < 5:
22779  * raise RuntimeError(u"Format string allocated too short.")
22780  */
22781  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error)
22782  __Pyx_GOTREF(__pyx_t_4);
22783  __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
22784  __pyx_t_4 = 0;
22785 
22786  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
22787  * if not PyDataType_HASFIELDS(child):
22788  * t = child.type_num
22789  * if end - f < 5: # <<<<<<<<<<<<<<
22790  * raise RuntimeError(u"Format string allocated too short.")
22791  *
22792  */
22793  __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
22794  if (unlikely(__pyx_t_6)) {
22795 
22796  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
22797  * t = child.type_num
22798  * if end - f < 5:
22799  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
22800  *
22801  * # Until ticket #99 is fixed, use integers to avoid warnings
22802  */
22803  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error)
22804  __Pyx_GOTREF(__pyx_t_4);
22805  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
22806  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22807  __PYX_ERR(1, 834, __pyx_L1_error)
22808 
22809  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
22810  * if not PyDataType_HASFIELDS(child):
22811  * t = child.type_num
22812  * if end - f < 5: # <<<<<<<<<<<<<<
22813  * raise RuntimeError(u"Format string allocated too short.")
22814  *
22815  */
22816  }
22817 
22818  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
22819  *
22820  * # Until ticket #99 is fixed, use integers to avoid warnings
22821  * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
22822  * elif t == NPY_UBYTE: f[0] = 66 #"B"
22823  * elif t == NPY_SHORT: f[0] = 104 #"h"
22824  */
22825  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error)
22826  __Pyx_GOTREF(__pyx_t_4);
22827  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error)
22828  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22829  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error)
22830  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22831  if (__pyx_t_6) {
22832  (__pyx_v_f[0]) = 98;
22833  goto __pyx_L15;
22834  }
22835 
22836  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
22837  * # Until ticket #99 is fixed, use integers to avoid warnings
22838  * if t == NPY_BYTE: f[0] = 98 #"b"
22839  * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
22840  * elif t == NPY_SHORT: f[0] = 104 #"h"
22841  * elif t == NPY_USHORT: f[0] = 72 #"H"
22842  */
22843  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error)
22844  __Pyx_GOTREF(__pyx_t_3);
22845  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error)
22846  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22847  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error)
22848  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22849  if (__pyx_t_6) {
22850  (__pyx_v_f[0]) = 66;
22851  goto __pyx_L15;
22852  }
22853 
22854  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":839
22855  * if t == NPY_BYTE: f[0] = 98 #"b"
22856  * elif t == NPY_UBYTE: f[0] = 66 #"B"
22857  * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
22858  * elif t == NPY_USHORT: f[0] = 72 #"H"
22859  * elif t == NPY_INT: f[0] = 105 #"i"
22860  */
22861  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error)
22862  __Pyx_GOTREF(__pyx_t_4);
22863  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error)
22864  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22865  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error)
22866  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22867  if (__pyx_t_6) {
22868  (__pyx_v_f[0]) = 0x68;
22869  goto __pyx_L15;
22870  }
22871 
22872  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
22873  * elif t == NPY_UBYTE: f[0] = 66 #"B"
22874  * elif t == NPY_SHORT: f[0] = 104 #"h"
22875  * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
22876  * elif t == NPY_INT: f[0] = 105 #"i"
22877  * elif t == NPY_UINT: f[0] = 73 #"I"
22878  */
22879  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error)
22880  __Pyx_GOTREF(__pyx_t_3);
22881  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error)
22882  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22883  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error)
22884  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22885  if (__pyx_t_6) {
22886  (__pyx_v_f[0]) = 72;
22887  goto __pyx_L15;
22888  }
22889 
22890  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":841
22891  * elif t == NPY_SHORT: f[0] = 104 #"h"
22892  * elif t == NPY_USHORT: f[0] = 72 #"H"
22893  * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
22894  * elif t == NPY_UINT: f[0] = 73 #"I"
22895  * elif t == NPY_LONG: f[0] = 108 #"l"
22896  */
22897  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error)
22898  __Pyx_GOTREF(__pyx_t_4);
22899  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error)
22900  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22901  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error)
22902  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22903  if (__pyx_t_6) {
22904  (__pyx_v_f[0]) = 0x69;
22905  goto __pyx_L15;
22906  }
22907 
22908  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
22909  * elif t == NPY_USHORT: f[0] = 72 #"H"
22910  * elif t == NPY_INT: f[0] = 105 #"i"
22911  * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
22912  * elif t == NPY_LONG: f[0] = 108 #"l"
22913  * elif t == NPY_ULONG: f[0] = 76 #"L"
22914  */
22915  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error)
22916  __Pyx_GOTREF(__pyx_t_3);
22917  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error)
22918  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22919  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error)
22920  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22921  if (__pyx_t_6) {
22922  (__pyx_v_f[0]) = 73;
22923  goto __pyx_L15;
22924  }
22925 
22926  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":843
22927  * elif t == NPY_INT: f[0] = 105 #"i"
22928  * elif t == NPY_UINT: f[0] = 73 #"I"
22929  * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
22930  * elif t == NPY_ULONG: f[0] = 76 #"L"
22931  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
22932  */
22933  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 843, __pyx_L1_error)
22934  __Pyx_GOTREF(__pyx_t_4);
22935  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 843, __pyx_L1_error)
22936  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22937  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 843, __pyx_L1_error)
22938  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22939  if (__pyx_t_6) {
22940  (__pyx_v_f[0]) = 0x6C;
22941  goto __pyx_L15;
22942  }
22943 
22944  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844
22945  * elif t == NPY_UINT: f[0] = 73 #"I"
22946  * elif t == NPY_LONG: f[0] = 108 #"l"
22947  * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
22948  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
22949  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
22950  */
22951  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error)
22952  __Pyx_GOTREF(__pyx_t_3);
22953  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error)
22954  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22955  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 844, __pyx_L1_error)
22956  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22957  if (__pyx_t_6) {
22958  (__pyx_v_f[0]) = 76;
22959  goto __pyx_L15;
22960  }
22961 
22962  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845
22963  * elif t == NPY_LONG: f[0] = 108 #"l"
22964  * elif t == NPY_ULONG: f[0] = 76 #"L"
22965  * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
22966  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
22967  * elif t == NPY_FLOAT: f[0] = 102 #"f"
22968  */
22969  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 845, __pyx_L1_error)
22970  __Pyx_GOTREF(__pyx_t_4);
22971  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 845, __pyx_L1_error)
22972  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22973  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 845, __pyx_L1_error)
22974  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22975  if (__pyx_t_6) {
22976  (__pyx_v_f[0]) = 0x71;
22977  goto __pyx_L15;
22978  }
22979 
22980  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":846
22981  * elif t == NPY_ULONG: f[0] = 76 #"L"
22982  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
22983  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
22984  * elif t == NPY_FLOAT: f[0] = 102 #"f"
22985  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
22986  */
22987  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 846, __pyx_L1_error)
22988  __Pyx_GOTREF(__pyx_t_3);
22989  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 846, __pyx_L1_error)
22990  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22991  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 846, __pyx_L1_error)
22992  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22993  if (__pyx_t_6) {
22994  (__pyx_v_f[0]) = 81;
22995  goto __pyx_L15;
22996  }
22997 
22998  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":847
22999  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
23000  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
23001  * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
23002  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
23003  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
23004  */
23005  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 847, __pyx_L1_error)
23006  __Pyx_GOTREF(__pyx_t_4);
23007  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 847, __pyx_L1_error)
23008  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23009  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 847, __pyx_L1_error)
23010  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23011  if (__pyx_t_6) {
23012  (__pyx_v_f[0]) = 0x66;
23013  goto __pyx_L15;
23014  }
23015 
23016  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":848
23017  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
23018  * elif t == NPY_FLOAT: f[0] = 102 #"f"
23019  * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
23020  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
23021  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
23022  */
23023  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 848, __pyx_L1_error)
23024  __Pyx_GOTREF(__pyx_t_3);
23025  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 848, __pyx_L1_error)
23026  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23027  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 848, __pyx_L1_error)
23028  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23029  if (__pyx_t_6) {
23030  (__pyx_v_f[0]) = 0x64;
23031  goto __pyx_L15;
23032  }
23033 
23034  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":849
23035  * elif t == NPY_FLOAT: f[0] = 102 #"f"
23036  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
23037  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
23038  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
23039  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
23040  */
23041  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 849, __pyx_L1_error)
23042  __Pyx_GOTREF(__pyx_t_4);
23043  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 849, __pyx_L1_error)
23044  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23045  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 849, __pyx_L1_error)
23046  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23047  if (__pyx_t_6) {
23048  (__pyx_v_f[0]) = 0x67;
23049  goto __pyx_L15;
23050  }
23051 
23052  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":850
23053  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
23054  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
23055  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
23056  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
23057  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
23058  */
23059  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 850, __pyx_L1_error)
23060  __Pyx_GOTREF(__pyx_t_3);
23061  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 850, __pyx_L1_error)
23062  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23063  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 850, __pyx_L1_error)
23064  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23065  if (__pyx_t_6) {
23066  (__pyx_v_f[0]) = 90;
23067  (__pyx_v_f[1]) = 0x66;
23068  __pyx_v_f = (__pyx_v_f + 1);
23069  goto __pyx_L15;
23070  }
23071 
23072  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
23073  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
23074  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
23075  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
23076  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
23077  * elif t == NPY_OBJECT: f[0] = 79 #"O"
23078  */
23079  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 851, __pyx_L1_error)
23080  __Pyx_GOTREF(__pyx_t_4);
23081  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
23082  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23083  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 851, __pyx_L1_error)
23084  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23085  if (__pyx_t_6) {
23086  (__pyx_v_f[0]) = 90;
23087  (__pyx_v_f[1]) = 0x64;
23088  __pyx_v_f = (__pyx_v_f + 1);
23089  goto __pyx_L15;
23090  }
23091 
23092  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":852
23093  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
23094  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
23095  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
23096  * elif t == NPY_OBJECT: f[0] = 79 #"O"
23097  * else:
23098  */
23099  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
23100  __Pyx_GOTREF(__pyx_t_3);
23101  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 852, __pyx_L1_error)
23102  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23103  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 852, __pyx_L1_error)
23104  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23105  if (__pyx_t_6) {
23106  (__pyx_v_f[0]) = 90;
23107  (__pyx_v_f[1]) = 0x67;
23108  __pyx_v_f = (__pyx_v_f + 1);
23109  goto __pyx_L15;
23110  }
23111 
23112  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":853
23113  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
23114  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
23115  * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
23116  * else:
23117  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
23118  */
23119  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
23120  __Pyx_GOTREF(__pyx_t_4);
23121  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
23122  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23123  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 853, __pyx_L1_error)
23124  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23125  if (likely(__pyx_t_6)) {
23126  (__pyx_v_f[0]) = 79;
23127  goto __pyx_L15;
23128  }
23129 
23130  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
23131  * elif t == NPY_OBJECT: f[0] = 79 #"O"
23132  * else:
23133  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
23134  * f += 1
23135  * else:
23136  */
23137  /*else*/ {
23138  __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
23139  __Pyx_GOTREF(__pyx_t_3);
23140  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
23141  __Pyx_GOTREF(__pyx_t_4);
23142  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23143  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
23144  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23145  __PYX_ERR(1, 855, __pyx_L1_error)
23146  }
23147  __pyx_L15:;
23148 
23149  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
23150  * else:
23151  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
23152  * f += 1 # <<<<<<<<<<<<<<
23153  * else:
23154  * # Cython ignores struct boundary information ("T{...}"),
23155  */
23156  __pyx_v_f = (__pyx_v_f + 1);
23157 
23158  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
23159  * offset[0] += child.itemsize
23160  *
23161  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
23162  * t = child.type_num
23163  * if end - f < 5:
23164  */
23165  goto __pyx_L13;
23166  }
23167 
23168  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":860
23169  * # Cython ignores struct boundary information ("T{...}"),
23170  * # so don't output it
23171  * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
23172  * return f
23173  *
23174  */
23175  /*else*/ {
23176  __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 860, __pyx_L1_error)
23177  __pyx_v_f = __pyx_t_9;
23178  }
23179  __pyx_L13:;
23180 
23181  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":805
23182  * cdef tuple fields
23183  *
23184  * for childname in descr.names: # <<<<<<<<<<<<<<
23185  * fields = descr.fields[childname]
23186  * child, new_offset = fields
23187  */
23188  }
23189  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23190 
23191  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":861
23192  * # so don't output it
23193  * f = _util_dtypestring(child, f, end, offset)
23194  * return f # <<<<<<<<<<<<<<
23195  *
23196  *
23197  */
23198  __pyx_r = __pyx_v_f;
23199  goto __pyx_L0;
23200 
23201  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":796
23202  * return ()
23203  *
23204  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
23205  * # Recursive utility function used in __getbuffer__ to get format
23206  * # string. The new location in the format string is returned.
23207  */
23208 
23209  /* function exit code */
23210  __pyx_L1_error:;
23211  __Pyx_XDECREF(__pyx_t_1);
23212  __Pyx_XDECREF(__pyx_t_3);
23213  __Pyx_XDECREF(__pyx_t_4);
23214  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
23215  __pyx_r = NULL;
23216  __pyx_L0:;
23217  __Pyx_XDECREF((PyObject *)__pyx_v_child);
23218  __Pyx_XDECREF(__pyx_v_fields);
23219  __Pyx_XDECREF(__pyx_v_childname);
23220  __Pyx_XDECREF(__pyx_v_new_offset);
23221  __Pyx_XDECREF(__pyx_v_t);
23222  __Pyx_RefNannyFinishContext();
23223  return __pyx_r;
23224 }
23225 
23226 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
23227  *
23228  *
23229  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
23230  * cdef PyObject* baseptr
23231  * if base is None:
23232  */
23233 
23234 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
23235  PyObject *__pyx_v_baseptr;
23236  __Pyx_RefNannyDeclarations
23237  int __pyx_t_1;
23238  int __pyx_t_2;
23239  __Pyx_RefNannySetupContext("set_array_base", 0);
23240 
23241  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":979
23242  * cdef inline void set_array_base(ndarray arr, object base):
23243  * cdef PyObject* baseptr
23244  * if base is None: # <<<<<<<<<<<<<<
23245  * baseptr = NULL
23246  * else:
23247  */
23248  __pyx_t_1 = (__pyx_v_base == Py_None);
23249  __pyx_t_2 = (__pyx_t_1 != 0);
23250  if (__pyx_t_2) {
23251 
23252  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980
23253  * cdef PyObject* baseptr
23254  * if base is None:
23255  * baseptr = NULL # <<<<<<<<<<<<<<
23256  * else:
23257  * Py_INCREF(base) # important to do this before decref below!
23258  */
23259  __pyx_v_baseptr = NULL;
23260 
23261  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":979
23262  * cdef inline void set_array_base(ndarray arr, object base):
23263  * cdef PyObject* baseptr
23264  * if base is None: # <<<<<<<<<<<<<<
23265  * baseptr = NULL
23266  * else:
23267  */
23268  goto __pyx_L3;
23269  }
23270 
23271  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":982
23272  * baseptr = NULL
23273  * else:
23274  * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<<
23275  * baseptr = <PyObject*>base
23276  * Py_XDECREF(arr.base)
23277  */
23278  /*else*/ {
23279  Py_INCREF(__pyx_v_base);
23280 
23281  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":983
23282  * else:
23283  * Py_INCREF(base) # important to do this before decref below!
23284  * baseptr = <PyObject*>base # <<<<<<<<<<<<<<
23285  * Py_XDECREF(arr.base)
23286  * arr.base = baseptr
23287  */
23288  __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
23289  }
23290  __pyx_L3:;
23291 
23292  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":984
23293  * Py_INCREF(base) # important to do this before decref below!
23294  * baseptr = <PyObject*>base
23295  * Py_XDECREF(arr.base) # <<<<<<<<<<<<<<
23296  * arr.base = baseptr
23297  *
23298  */
23299  Py_XDECREF(__pyx_v_arr->base);
23300 
23301  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":985
23302  * baseptr = <PyObject*>base
23303  * Py_XDECREF(arr.base)
23304  * arr.base = baseptr # <<<<<<<<<<<<<<
23305  *
23306  * cdef inline object get_array_base(ndarray arr):
23307  */
23308  __pyx_v_arr->base = __pyx_v_baseptr;
23309 
23310  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
23311  *
23312  *
23313  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
23314  * cdef PyObject* baseptr
23315  * if base is None:
23316  */
23317 
23318  /* function exit code */
23319  __Pyx_RefNannyFinishContext();
23320 }
23321 
23322 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987
23323  * arr.base = baseptr
23324  *
23325  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
23326  * if arr.base is NULL:
23327  * return None
23328  */
23329 
23330 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
23331  PyObject *__pyx_r = NULL;
23332  __Pyx_RefNannyDeclarations
23333  int __pyx_t_1;
23334  __Pyx_RefNannySetupContext("get_array_base", 0);
23335 
23336  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988
23337  *
23338  * cdef inline object get_array_base(ndarray arr):
23339  * if arr.base is NULL: # <<<<<<<<<<<<<<
23340  * return None
23341  * else:
23342  */
23343  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
23344  if (__pyx_t_1) {
23345 
23346  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
23347  * cdef inline object get_array_base(ndarray arr):
23348  * if arr.base is NULL:
23349  * return None # <<<<<<<<<<<<<<
23350  * else:
23351  * return <object>arr.base
23352  */
23353  __Pyx_XDECREF(__pyx_r);
23354  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23355  goto __pyx_L0;
23356 
23357  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988
23358  *
23359  * cdef inline object get_array_base(ndarray arr):
23360  * if arr.base is NULL: # <<<<<<<<<<<<<<
23361  * return None
23362  * else:
23363  */
23364  }
23365 
23366  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
23367  * return None
23368  * else:
23369  * return <object>arr.base # <<<<<<<<<<<<<<
23370  *
23371  *
23372  */
23373  /*else*/ {
23374  __Pyx_XDECREF(__pyx_r);
23375  __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
23376  __pyx_r = ((PyObject *)__pyx_v_arr->base);
23377  goto __pyx_L0;
23378  }
23379 
23380  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987
23381  * arr.base = baseptr
23382  *
23383  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
23384  * if arr.base is NULL:
23385  * return None
23386  */
23387 
23388  /* function exit code */
23389  __pyx_L0:;
23390  __Pyx_XGIVEREF(__pyx_r);
23391  __Pyx_RefNannyFinishContext();
23392  return __pyx_r;
23393 }
23394 
23395 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":996
23396  * # Versions of the import_* functions which are more suitable for
23397  * # Cython code.
23398  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
23399  * try:
23400  * _import_array()
23401  */
23402 
23403 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
23404  int __pyx_r;
23405  __Pyx_RefNannyDeclarations
23406  PyObject *__pyx_t_1 = NULL;
23407  PyObject *__pyx_t_2 = NULL;
23408  PyObject *__pyx_t_3 = NULL;
23409  int __pyx_t_4;
23410  PyObject *__pyx_t_5 = NULL;
23411  PyObject *__pyx_t_6 = NULL;
23412  PyObject *__pyx_t_7 = NULL;
23413  PyObject *__pyx_t_8 = NULL;
23414  __Pyx_RefNannySetupContext("import_array", 0);
23415 
23416  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
23417  * # Cython code.
23418  * cdef inline int import_array() except -1:
23419  * try: # <<<<<<<<<<<<<<
23420  * _import_array()
23421  * except Exception:
23422  */
23423  {
23424  __Pyx_PyThreadState_declare
23425  __Pyx_PyThreadState_assign
23426  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
23427  __Pyx_XGOTREF(__pyx_t_1);
23428  __Pyx_XGOTREF(__pyx_t_2);
23429  __Pyx_XGOTREF(__pyx_t_3);
23430  /*try:*/ {
23431 
23432  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
23433  * cdef inline int import_array() except -1:
23434  * try:
23435  * _import_array() # <<<<<<<<<<<<<<
23436  * except Exception:
23437  * raise ImportError("numpy.core.multiarray failed to import")
23438  */
23439  __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 998, __pyx_L3_error)
23440 
23441  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
23442  * # Cython code.
23443  * cdef inline int import_array() except -1:
23444  * try: # <<<<<<<<<<<<<<
23445  * _import_array()
23446  * except Exception:
23447  */
23448  }
23449  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
23450  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
23451  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
23452  goto __pyx_L8_try_end;
23453  __pyx_L3_error:;
23454 
23455  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":999
23456  * try:
23457  * _import_array()
23458  * except Exception: # <<<<<<<<<<<<<<
23459  * raise ImportError("numpy.core.multiarray failed to import")
23460  *
23461  */
23462  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
23463  if (__pyx_t_4) {
23464  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
23465  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 999, __pyx_L5_except_error)
23466  __Pyx_GOTREF(__pyx_t_5);
23467  __Pyx_GOTREF(__pyx_t_6);
23468  __Pyx_GOTREF(__pyx_t_7);
23469 
23470  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000
23471  * _import_array()
23472  * except Exception:
23473  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
23474  *
23475  * cdef inline int import_umath() except -1:
23476  */
23477  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1000, __pyx_L5_except_error)
23478  __Pyx_GOTREF(__pyx_t_8);
23479  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
23480  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23481  __PYX_ERR(1, 1000, __pyx_L5_except_error)
23482  }
23483  goto __pyx_L5_except_error;
23484  __pyx_L5_except_error:;
23485 
23486  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
23487  * # Cython code.
23488  * cdef inline int import_array() except -1:
23489  * try: # <<<<<<<<<<<<<<
23490  * _import_array()
23491  * except Exception:
23492  */
23493  __Pyx_XGIVEREF(__pyx_t_1);
23494  __Pyx_XGIVEREF(__pyx_t_2);
23495  __Pyx_XGIVEREF(__pyx_t_3);
23496  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23497  goto __pyx_L1_error;
23498  __pyx_L8_try_end:;
23499  }
23500 
23501  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":996
23502  * # Versions of the import_* functions which are more suitable for
23503  * # Cython code.
23504  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
23505  * try:
23506  * _import_array()
23507  */
23508 
23509  /* function exit code */
23510  __pyx_r = 0;
23511  goto __pyx_L0;
23512  __pyx_L1_error:;
23513  __Pyx_XDECREF(__pyx_t_5);
23514  __Pyx_XDECREF(__pyx_t_6);
23515  __Pyx_XDECREF(__pyx_t_7);
23516  __Pyx_XDECREF(__pyx_t_8);
23517  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
23518  __pyx_r = -1;
23519  __pyx_L0:;
23520  __Pyx_RefNannyFinishContext();
23521  return __pyx_r;
23522 }
23523 
23524 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1002
23525  * raise ImportError("numpy.core.multiarray failed to import")
23526  *
23527  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
23528  * try:
23529  * _import_umath()
23530  */
23531 
23532 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
23533  int __pyx_r;
23534  __Pyx_RefNannyDeclarations
23535  PyObject *__pyx_t_1 = NULL;
23536  PyObject *__pyx_t_2 = NULL;
23537  PyObject *__pyx_t_3 = NULL;
23538  int __pyx_t_4;
23539  PyObject *__pyx_t_5 = NULL;
23540  PyObject *__pyx_t_6 = NULL;
23541  PyObject *__pyx_t_7 = NULL;
23542  PyObject *__pyx_t_8 = NULL;
23543  __Pyx_RefNannySetupContext("import_umath", 0);
23544 
23545  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1003
23546  *
23547  * cdef inline int import_umath() except -1:
23548  * try: # <<<<<<<<<<<<<<
23549  * _import_umath()
23550  * except Exception:
23551  */
23552  {
23553  __Pyx_PyThreadState_declare
23554  __Pyx_PyThreadState_assign
23555  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
23556  __Pyx_XGOTREF(__pyx_t_1);
23557  __Pyx_XGOTREF(__pyx_t_2);
23558  __Pyx_XGOTREF(__pyx_t_3);
23559  /*try:*/ {
23560 
23561  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1004
23562  * cdef inline int import_umath() except -1:
23563  * try:
23564  * _import_umath() # <<<<<<<<<<<<<<
23565  * except Exception:
23566  * raise ImportError("numpy.core.umath failed to import")
23567  */
23568  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1004, __pyx_L3_error)
23569 
23570  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1003
23571  *
23572  * cdef inline int import_umath() except -1:
23573  * try: # <<<<<<<<<<<<<<
23574  * _import_umath()
23575  * except Exception:
23576  */
23577  }
23578  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
23579  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
23580  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
23581  goto __pyx_L8_try_end;
23582  __pyx_L3_error:;
23583 
23584  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1005
23585  * try:
23586  * _import_umath()
23587  * except Exception: # <<<<<<<<<<<<<<
23588  * raise ImportError("numpy.core.umath failed to import")
23589  *
23590  */
23591  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
23592  if (__pyx_t_4) {
23593  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
23594  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1005, __pyx_L5_except_error)
23595  __Pyx_GOTREF(__pyx_t_5);
23596  __Pyx_GOTREF(__pyx_t_6);
23597  __Pyx_GOTREF(__pyx_t_7);
23598 
23599  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1006
23600  * _import_umath()
23601  * except Exception:
23602  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
23603  *
23604  * cdef inline int import_ufunc() except -1:
23605  */
23606  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1006, __pyx_L5_except_error)
23607  __Pyx_GOTREF(__pyx_t_8);
23608  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
23609  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23610  __PYX_ERR(1, 1006, __pyx_L5_except_error)
23611  }
23612  goto __pyx_L5_except_error;
23613  __pyx_L5_except_error:;
23614 
23615  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1003
23616  *
23617  * cdef inline int import_umath() except -1:
23618  * try: # <<<<<<<<<<<<<<
23619  * _import_umath()
23620  * except Exception:
23621  */
23622  __Pyx_XGIVEREF(__pyx_t_1);
23623  __Pyx_XGIVEREF(__pyx_t_2);
23624  __Pyx_XGIVEREF(__pyx_t_3);
23625  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23626  goto __pyx_L1_error;
23627  __pyx_L8_try_end:;
23628  }
23629 
23630  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1002
23631  * raise ImportError("numpy.core.multiarray failed to import")
23632  *
23633  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
23634  * try:
23635  * _import_umath()
23636  */
23637 
23638  /* function exit code */
23639  __pyx_r = 0;
23640  goto __pyx_L0;
23641  __pyx_L1_error:;
23642  __Pyx_XDECREF(__pyx_t_5);
23643  __Pyx_XDECREF(__pyx_t_6);
23644  __Pyx_XDECREF(__pyx_t_7);
23645  __Pyx_XDECREF(__pyx_t_8);
23646  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
23647  __pyx_r = -1;
23648  __pyx_L0:;
23649  __Pyx_RefNannyFinishContext();
23650  return __pyx_r;
23651 }
23652 
23653 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1008
23654  * raise ImportError("numpy.core.umath failed to import")
23655  *
23656  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
23657  * try:
23658  * _import_umath()
23659  */
23660 
23661 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
23662  int __pyx_r;
23663  __Pyx_RefNannyDeclarations
23664  PyObject *__pyx_t_1 = NULL;
23665  PyObject *__pyx_t_2 = NULL;
23666  PyObject *__pyx_t_3 = NULL;
23667  int __pyx_t_4;
23668  PyObject *__pyx_t_5 = NULL;
23669  PyObject *__pyx_t_6 = NULL;
23670  PyObject *__pyx_t_7 = NULL;
23671  PyObject *__pyx_t_8 = NULL;
23672  __Pyx_RefNannySetupContext("import_ufunc", 0);
23673 
23674  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1009
23675  *
23676  * cdef inline int import_ufunc() except -1:
23677  * try: # <<<<<<<<<<<<<<
23678  * _import_umath()
23679  * except Exception:
23680  */
23681  {
23682  __Pyx_PyThreadState_declare
23683  __Pyx_PyThreadState_assign
23684  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
23685  __Pyx_XGOTREF(__pyx_t_1);
23686  __Pyx_XGOTREF(__pyx_t_2);
23687  __Pyx_XGOTREF(__pyx_t_3);
23688  /*try:*/ {
23689 
23690  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1010
23691  * cdef inline int import_ufunc() except -1:
23692  * try:
23693  * _import_umath() # <<<<<<<<<<<<<<
23694  * except Exception:
23695  * raise ImportError("numpy.core.umath failed to import")
23696  */
23697  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1010, __pyx_L3_error)
23698 
23699  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1009
23700  *
23701  * cdef inline int import_ufunc() except -1:
23702  * try: # <<<<<<<<<<<<<<
23703  * _import_umath()
23704  * except Exception:
23705  */
23706  }
23707  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
23708  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
23709  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
23710  goto __pyx_L8_try_end;
23711  __pyx_L3_error:;
23712 
23713  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1011
23714  * try:
23715  * _import_umath()
23716  * except Exception: # <<<<<<<<<<<<<<
23717  * raise ImportError("numpy.core.umath failed to import")
23718  */
23719  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
23720  if (__pyx_t_4) {
23721  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
23722  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1011, __pyx_L5_except_error)
23723  __Pyx_GOTREF(__pyx_t_5);
23724  __Pyx_GOTREF(__pyx_t_6);
23725  __Pyx_GOTREF(__pyx_t_7);
23726 
23727  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1012
23728  * _import_umath()
23729  * except Exception:
23730  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
23731  */
23732  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1012, __pyx_L5_except_error)
23733  __Pyx_GOTREF(__pyx_t_8);
23734  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
23735  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23736  __PYX_ERR(1, 1012, __pyx_L5_except_error)
23737  }
23738  goto __pyx_L5_except_error;
23739  __pyx_L5_except_error:;
23740 
23741  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1009
23742  *
23743  * cdef inline int import_ufunc() except -1:
23744  * try: # <<<<<<<<<<<<<<
23745  * _import_umath()
23746  * except Exception:
23747  */
23748  __Pyx_XGIVEREF(__pyx_t_1);
23749  __Pyx_XGIVEREF(__pyx_t_2);
23750  __Pyx_XGIVEREF(__pyx_t_3);
23751  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23752  goto __pyx_L1_error;
23753  __pyx_L8_try_end:;
23754  }
23755 
23756  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1008
23757  * raise ImportError("numpy.core.umath failed to import")
23758  *
23759  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
23760  * try:
23761  * _import_umath()
23762  */
23763 
23764  /* function exit code */
23765  __pyx_r = 0;
23766  goto __pyx_L0;
23767  __pyx_L1_error:;
23768  __Pyx_XDECREF(__pyx_t_5);
23769  __Pyx_XDECREF(__pyx_t_6);
23770  __Pyx_XDECREF(__pyx_t_7);
23771  __Pyx_XDECREF(__pyx_t_8);
23772  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
23773  __pyx_r = -1;
23774  __pyx_L0:;
23775  __Pyx_RefNannyFinishContext();
23776  return __pyx_r;
23777 }
23778 
23779 static PyMethodDef __pyx_methods[] = {
23780  {0, 0, 0, 0}
23781 };
23782 
23783 #if PY_MAJOR_VERSION >= 3
23784 #if CYTHON_PEP489_MULTI_PHASE_INIT
23785 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
23786 static int __pyx_pymod_exec_subsurfaceTransportFunctions(PyObject* module); /*proto*/
23787 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
23788  {Py_mod_create, (void*)__pyx_pymod_create},
23789  {Py_mod_exec, (void*)__pyx_pymod_exec_subsurfaceTransportFunctions},
23790  {0, NULL}
23791 };
23792 #endif
23793 
23794 static struct PyModuleDef __pyx_moduledef = {
23795  PyModuleDef_HEAD_INIT,
23796  "subsurfaceTransportFunctions",
23797  0, /* m_doc */
23798  #if CYTHON_PEP489_MULTI_PHASE_INIT
23799  0, /* m_size */
23800  #else
23801  -1, /* m_size */
23802  #endif
23803  __pyx_methods /* m_methods */,
23804  #if CYTHON_PEP489_MULTI_PHASE_INIT
23805  __pyx_moduledef_slots, /* m_slots */
23806  #else
23807  NULL, /* m_reload */
23808  #endif
23809  NULL, /* m_traverse */
23810  NULL, /* m_clear */
23811  NULL /* m_free */
23812 };
23813 #endif
23814 
23815 static __Pyx_StringTabEntry __pyx_string_tab[] = {
23816  {&__pyx_n_s_DKWr_DpsiC, __pyx_k_DKWr_DpsiC, sizeof(__pyx_k_DKWr_DpsiC), 0, 0, 1, 1},
23817  {&__pyx_n_s_DsBar_DpsiC, __pyx_k_DsBar_DpsiC, sizeof(__pyx_k_DsBar_DpsiC), 0, 0, 1, 1},
23818  {&__pyx_n_s_DthetaW_DpsiC, __pyx_k_DthetaW_DpsiC, sizeof(__pyx_k_DthetaW_DpsiC), 0, 0, 1, 1},
23819  {&__pyx_n_s_DvBar_DpsiC, __pyx_k_DvBar_DpsiC, sizeof(__pyx_k_DvBar_DpsiC), 0, 0, 1, 1},
23820  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
23821  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
23822  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
23823  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
23824  {&__pyx_n_s_J, __pyx_k_J, sizeof(__pyx_k_J), 0, 0, 1, 1},
23825  {&__pyx_n_s_KWr, __pyx_k_KWr, sizeof(__pyx_k_KWr), 0, 0, 1, 1},
23826  {&__pyx_n_s_KWs, __pyx_k_KWs, sizeof(__pyx_k_KWs), 0, 0, 1, 1},
23827  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
23828  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_k_RE_NCP1_evaluateElementCoefficie, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie), 0, 0, 1, 1},
23829  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_k_RE_NCP1_evaluateElementCoefficie_2, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie_2), 0, 0, 1, 1},
23830  {&__pyx_n_s_RE_NCP1_getElementJacobian, __pyx_k_RE_NCP1_getElementJacobian, sizeof(__pyx_k_RE_NCP1_getElementJacobian), 0, 0, 1, 1},
23831  {&__pyx_n_s_RE_NCP1_getElementResidual, __pyx_k_RE_NCP1_getElementResidual, sizeof(__pyx_k_RE_NCP1_getElementResidual), 0, 0, 1, 1},
23832  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
23833  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
23834  {&__pyx_n_s_a_avg, __pyx_k_a_avg, sizeof(__pyx_k_a_avg), 0, 0, 1, 1},
23835  {&__pyx_n_s_a_eN, __pyx_k_a_eN, sizeof(__pyx_k_a_eN), 0, 0, 1, 1},
23836  {&__pyx_n_s_a_neig, __pyx_k_a_neig, sizeof(__pyx_k_a_neig), 0, 0, 1, 1},
23837  {&__pyx_n_s_a_up, __pyx_k_a_up, sizeof(__pyx_k_a_up), 0, 0, 1, 1},
23838  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
23839  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
23840  {&__pyx_n_s_calculateNormalFlux, __pyx_k_calculateNormalFlux, sizeof(__pyx_k_calculateNormalFlux), 0, 0, 1, 1},
23841  {&__pyx_n_s_characteristic_velocity, __pyx_k_characteristic_velocity, sizeof(__pyx_k_characteristic_velocity), 0, 0, 1, 1},
23842  {&__pyx_n_s_characteristic_velocity_dofs, __pyx_k_characteristic_velocity_dofs, sizeof(__pyx_k_characteristic_velocity_dofs), 0, 0, 1, 1},
23843  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
23844  {&__pyx_n_s_clock, __pyx_k_clock, sizeof(__pyx_k_clock), 0, 0, 1, 1},
23845  {&__pyx_n_s_colind, __pyx_k_colind, sizeof(__pyx_k_colind), 0, 0, 1, 1},
23846  {&__pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_k_computeSimpleCharacteristicVeloc, sizeof(__pyx_k_computeSimpleCharacteristicVeloc), 0, 0, 1, 1},
23847  {&__pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_k_computeSimpleCharacteristicVeloc_2, sizeof(__pyx_k_computeSimpleCharacteristicVeloc_2), 0, 0, 1, 1},
23848  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
23849  {&__pyx_n_s_dS, __pyx_k_dS, sizeof(__pyx_k_dS), 0, 0, 1, 1},
23850  {&__pyx_n_s_dV, __pyx_k_dV, sizeof(__pyx_k_dV), 0, 0, 1, 1},
23851  {&__pyx_n_s_denom, __pyx_k_denom, sizeof(__pyx_k_denom), 0, 0, 1, 1},
23852  {&__pyx_n_s_df, __pyx_k_df, sizeof(__pyx_k_df), 0, 0, 1, 1},
23853  {&__pyx_n_s_df_dofs, __pyx_k_df_dofs, sizeof(__pyx_k_df_dofs), 0, 0, 1, 1},
23854  {&__pyx_n_s_dkr_up, __pyx_k_dkr_up, sizeof(__pyx_k_dkr_up), 0, 0, 1, 1},
23855  {&__pyx_n_s_dm, __pyx_k_dm, sizeof(__pyx_k_dm), 0, 0, 1, 1},
23856  {&__pyx_n_s_dmt, __pyx_k_dmt, sizeof(__pyx_k_dmt), 0, 0, 1, 1},
23857  {&__pyx_n_s_dmtj_avg, __pyx_k_dmtj_avg, sizeof(__pyx_k_dmtj_avg), 0, 0, 1, 1},
23858  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
23859  {&__pyx_n_s_drhom, __pyx_k_drhom, sizeof(__pyx_k_drhom), 0, 0, 1, 1},
23860  {&__pyx_n_s_eN, __pyx_k_eN, sizeof(__pyx_k_eN), 0, 0, 1, 1},
23861  {&__pyx_n_s_eN_left, __pyx_k_eN_left, sizeof(__pyx_k_eN_left), 0, 0, 1, 1},
23862  {&__pyx_n_s_eN_neighbor, __pyx_k_eN_neighbor, sizeof(__pyx_k_eN_neighbor), 0, 0, 1, 1},
23863  {&__pyx_n_s_eN_right, __pyx_k_eN_right, sizeof(__pyx_k_eN_right), 0, 0, 1, 1},
23864  {&__pyx_n_s_ebN, __pyx_k_ebN, sizeof(__pyx_k_ebN), 0, 0, 1, 1},
23865  {&__pyx_n_s_ebNE, __pyx_k_ebNE, sizeof(__pyx_k_ebNE), 0, 0, 1, 1},
23866  {&__pyx_n_s_ebN_local, __pyx_k_ebN_local, sizeof(__pyx_k_ebN_local), 0, 0, 1, 1},
23867  {&__pyx_n_s_ebq_global_vals, __pyx_k_ebq_global_vals, sizeof(__pyx_k_ebq_global_vals), 0, 0, 1, 1},
23868  {&__pyx_n_s_ebq_vals, __pyx_k_ebq_vals, sizeof(__pyx_k_ebq_vals), 0, 0, 1, 1},
23869  {&__pyx_n_s_elementBarycentersArray, __pyx_k_elementBarycentersArray, sizeof(__pyx_k_elementBarycentersArray), 0, 0, 1, 1},
23870  {&__pyx_n_s_elementBoundariesArray, __pyx_k_elementBoundariesArray, sizeof(__pyx_k_elementBoundariesArray), 0, 0, 1, 1},
23871  {&__pyx_n_s_elementBoundaryElementsArray, __pyx_k_elementBoundaryElementsArray, sizeof(__pyx_k_elementBoundaryElementsArray), 0, 0, 1, 1},
23872  {&__pyx_n_s_elementBoundaryMaterialTypes, __pyx_k_elementBoundaryMaterialTypes, sizeof(__pyx_k_elementBoundaryMaterialTypes), 0, 0, 1, 1},
23873  {&__pyx_n_s_elementBoundaryTypes, __pyx_k_elementBoundaryTypes, sizeof(__pyx_k_elementBoundaryTypes), 0, 0, 1, 1},
23874  {&__pyx_n_s_elementJacobian, __pyx_k_elementJacobian, sizeof(__pyx_k_elementJacobian), 0, 0, 1, 1},
23875  {&__pyx_n_s_elementMaterialTypes, __pyx_k_elementMaterialTypes, sizeof(__pyx_k_elementMaterialTypes), 0, 0, 1, 1},
23876  {&__pyx_n_s_elementNeighborsArray, __pyx_k_elementNeighborsArray, sizeof(__pyx_k_elementNeighborsArray), 0, 0, 1, 1},
23877  {&__pyx_n_s_elementResidual, __pyx_k_elementResidual, sizeof(__pyx_k_elementResidual), 0, 0, 1, 1},
23878  {&__pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_k_evaluateScalarMaterialFunctionOv, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv), 0, 0, 1, 1},
23879  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_k_evaluateScalarMaterialFunctionOv_2, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_2), 0, 0, 1, 1},
23880  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_k_evaluateScalarMaterialFunctionOv_3, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_3), 0, 0, 1, 1},
23881  {&__pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_k_evaluateSparseTensorMaterialFunc, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc), 0, 0, 1, 1},
23882  {&__pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_k_evaluateSparseTensorMaterialFunc_2, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc_2), 0, 0, 1, 1},
23883  {&__pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_k_evaluateVectorMaterialFunctionOv, sizeof(__pyx_k_evaluateVectorMaterialFunctionOv), 0, 0, 1, 1},
23884  {&__pyx_n_s_exteriorElementBoundariesArray, __pyx_k_exteriorElementBoundariesArray, sizeof(__pyx_k_exteriorElementBoundariesArray), 0, 0, 1, 1},
23885  {&__pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_k_exteriorElementBoundaryMaterialT, sizeof(__pyx_k_exteriorElementBoundaryMaterialT), 0, 0, 1, 1},
23886  {&__pyx_n_s_f_up, __pyx_k_f_up, sizeof(__pyx_k_f_up), 0, 0, 1, 1},
23887  {&__pyx_n_s_flat, __pyx_k_flat, sizeof(__pyx_k_flat), 0, 0, 1, 1},
23888  {&__pyx_n_s_flux, __pyx_k_flux, sizeof(__pyx_k_flux), 0, 0, 1, 1},
23889  {&__pyx_n_s_gravity, __pyx_k_gravity, sizeof(__pyx_k_gravity), 0, 0, 1, 1},
23890  {&__pyx_n_s_helicalElementVelocityEval3, __pyx_k_helicalElementVelocityEval3, sizeof(__pyx_k_helicalElementVelocityEval3), 0, 0, 1, 1},
23891  {&__pyx_n_s_helicalElementVelocityEval4, __pyx_k_helicalElementVelocityEval4, sizeof(__pyx_k_helicalElementVelocityEval4), 0, 0, 1, 1},
23892  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
23893  {&__pyx_n_s_ii, __pyx_k_ii, sizeof(__pyx_k_ii), 0, 0, 1, 1},
23894  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
23895  {&__pyx_n_s_integral, __pyx_k_integral, sizeof(__pyx_k_integral), 0, 0, 1, 1},
23896  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
23897  {&__pyx_n_s_jacobian_weak_residual, __pyx_k_jacobian_weak_residual, sizeof(__pyx_k_jacobian_weak_residual), 0, 0, 1, 1},
23898  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
23899  {&__pyx_n_s_kb, __pyx_k_kb, sizeof(__pyx_k_kb), 0, 0, 1, 1},
23900  {&__pyx_n_s_kr_eN, __pyx_k_kr_eN, sizeof(__pyx_k_kr_eN), 0, 0, 1, 1},
23901  {&__pyx_n_s_kr_neig, __pyx_k_kr_neig, sizeof(__pyx_k_kr_neig), 0, 0, 1, 1},
23902  {&__pyx_n_s_l2g, __pyx_k_l2g, sizeof(__pyx_k_l2g), 0, 0, 1, 1},
23903  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
23904  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
23905  {&__pyx_n_s_matID, __pyx_k_matID, sizeof(__pyx_k_matID), 0, 0, 1, 1},
23906  {&__pyx_n_s_matID_neig, __pyx_k_matID_neig, sizeof(__pyx_k_matID_neig), 0, 0, 1, 1},
23907  {&__pyx_n_s_material, __pyx_k_material, sizeof(__pyx_k_material), 0, 0, 1, 1},
23908  {&__pyx_n_s_material_functions, __pyx_k_material_functions, sizeof(__pyx_k_material_functions), 0, 0, 1, 1},
23909  {&__pyx_n_s_material_left, __pyx_k_material_left, sizeof(__pyx_k_material_left), 0, 0, 1, 1},
23910  {&__pyx_n_s_material_right, __pyx_k_material_right, sizeof(__pyx_k_material_right), 0, 0, 1, 1},
23911  {&__pyx_n_s_mt, __pyx_k_mt, sizeof(__pyx_k_mt), 0, 0, 1, 1},
23912  {&__pyx_n_s_mt_avg, __pyx_k_mt_avg, sizeof(__pyx_k_mt_avg), 0, 0, 1, 1},
23913  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
23914  {&__pyx_n_s_nAvgWeight, __pyx_k_nAvgWeight, sizeof(__pyx_k_nAvgWeight), 0, 0, 1, 1},
23915  {&__pyx_n_s_nDOF_test_element, __pyx_k_nDOF_test_element, sizeof(__pyx_k_nDOF_test_element), 0, 0, 1, 1},
23916  {&__pyx_n_s_nDOF_trial_element, __pyx_k_nDOF_trial_element, sizeof(__pyx_k_nDOF_trial_element), 0, 0, 1, 1},
23917  {&__pyx_n_s_nElementBoundaries_element, __pyx_k_nElementBoundaries_element, sizeof(__pyx_k_nElementBoundaries_element), 0, 0, 1, 1},
23918  {&__pyx_n_s_nElementBoundaries_global, __pyx_k_nElementBoundaries_global, sizeof(__pyx_k_nElementBoundaries_global), 0, 0, 1, 1},
23919  {&__pyx_n_s_nElements_global, __pyx_k_nElements_global, sizeof(__pyx_k_nElements_global), 0, 0, 1, 1},
23920  {&__pyx_n_s_nExteriorElementBoundaries_globa, __pyx_k_nExteriorElementBoundaries_globa, sizeof(__pyx_k_nExteriorElementBoundaries_globa), 0, 0, 1, 1},
23921  {&__pyx_n_s_nSpace, __pyx_k_nSpace, sizeof(__pyx_k_nSpace), 0, 0, 1, 1},
23922  {&__pyx_n_s_nSpace2, __pyx_k_nSpace2, sizeof(__pyx_k_nSpace2), 0, 0, 1, 1},
23923  {&__pyx_n_s_nd, __pyx_k_nd, sizeof(__pyx_k_nd), 0, 0, 1, 1},
23924  {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
23925  {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
23926  {&__pyx_n_s_nnz, __pyx_k_nnz, sizeof(__pyx_k_nnz), 0, 0, 1, 1},
23927  {&__pyx_n_s_numer, __pyx_k_numer, sizeof(__pyx_k_numer), 0, 0, 1, 1},
23928  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
23929  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
23930  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
23931  {&__pyx_n_s_omega_e, __pyx_k_omega_e, sizeof(__pyx_k_omega_e), 0, 0, 1, 1},
23932  {&__pyx_n_s_one8, __pyx_k_one8, sizeof(__pyx_k_one8), 0, 0, 1, 1},
23933  {&__pyx_n_s_onePlus_pcBar_n, __pyx_k_onePlus_pcBar_n, sizeof(__pyx_k_onePlus_pcBar_n), 0, 0, 1, 1},
23934  {&__pyx_n_s_pcBar, __pyx_k_pcBar, sizeof(__pyx_k_pcBar), 0, 0, 1, 1},
23935  {&__pyx_n_s_pcBar_n, __pyx_k_pcBar_n, sizeof(__pyx_k_pcBar_n), 0, 0, 1, 1},
23936  {&__pyx_n_s_pcBar_nM1, __pyx_k_pcBar_nM1, sizeof(__pyx_k_pcBar_nM1), 0, 0, 1, 1},
23937  {&__pyx_n_s_pcBar_nM2, __pyx_k_pcBar_nM2, sizeof(__pyx_k_pcBar_nM2), 0, 0, 1, 1},
23938  {&__pyx_n_s_phi_eN, __pyx_k_phi_eN, sizeof(__pyx_k_phi_eN), 0, 0, 1, 1},
23939  {&__pyx_n_s_phi_neig, __pyx_k_phi_neig, sizeof(__pyx_k_phi_neig), 0, 0, 1, 1},
23940  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
23941  {&__pyx_n_s_picard, __pyx_k_picard, sizeof(__pyx_k_picard), 0, 0, 1, 1},
23942  {&__pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_k_proteus_subsurfaceTransportFunct, sizeof(__pyx_k_proteus_subsurfaceTransportFunct), 0, 0, 1, 0},
23943  {&__pyx_n_s_psiC, __pyx_k_psiC, sizeof(__pyx_k_psiC), 0, 0, 1, 1},
23944  {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
23945  {&__pyx_n_s_q_alin, __pyx_k_q_alin, sizeof(__pyx_k_q_alin), 0, 0, 1, 1},
23946  {&__pyx_n_s_q_detJ, __pyx_k_q_detJ, sizeof(__pyx_k_q_detJ), 0, 0, 1, 1},
23947  {&__pyx_n_s_q_dkr, __pyx_k_q_dkr, sizeof(__pyx_k_q_dkr), 0, 0, 1, 1},
23948  {&__pyx_n_s_q_dm, __pyx_k_q_dm, sizeof(__pyx_k_q_dm), 0, 0, 1, 1},
23949  {&__pyx_n_s_q_dmass, __pyx_k_q_dmass, sizeof(__pyx_k_q_dmass), 0, 0, 1, 1},
23950  {&__pyx_n_s_q_dmt, __pyx_k_q_dmt, sizeof(__pyx_k_q_dmt), 0, 0, 1, 1},
23951  {&__pyx_n_s_q_flin, __pyx_k_q_flin, sizeof(__pyx_k_q_flin), 0, 0, 1, 1},
23952  {&__pyx_n_s_q_grad_u, __pyx_k_q_grad_u, sizeof(__pyx_k_q_grad_u), 0, 0, 1, 1},
23953  {&__pyx_n_s_q_grad_v, __pyx_k_q_grad_v, sizeof(__pyx_k_q_grad_v), 0, 0, 1, 1},
23954  {&__pyx_n_s_q_grad_w, __pyx_k_q_grad_w, sizeof(__pyx_k_q_grad_w), 0, 0, 1, 1},
23955  {&__pyx_n_s_q_kr, __pyx_k_q_kr, sizeof(__pyx_k_q_kr), 0, 0, 1, 1},
23956  {&__pyx_n_s_q_kr_up, __pyx_k_q_kr_up, sizeof(__pyx_k_q_kr_up), 0, 0, 1, 1},
23957  {&__pyx_n_s_q_m, __pyx_k_q_m, sizeof(__pyx_k_q_m), 0, 0, 1, 1},
23958  {&__pyx_n_s_q_mass, __pyx_k_q_mass, sizeof(__pyx_k_q_mass), 0, 0, 1, 1},
23959  {&__pyx_n_s_q_mt, __pyx_k_q_mt, sizeof(__pyx_k_q_mt), 0, 0, 1, 1},
23960  {&__pyx_n_s_q_r, __pyx_k_q_r, sizeof(__pyx_k_q_r), 0, 0, 1, 1},
23961  {&__pyx_n_s_q_u, __pyx_k_q_u, sizeof(__pyx_k_q_u), 0, 0, 1, 1},
23962  {&__pyx_n_s_q_vals, __pyx_k_q_vals, sizeof(__pyx_k_q_vals), 0, 0, 1, 1},
23963  {&__pyx_n_s_q_x, __pyx_k_q_x, sizeof(__pyx_k_q_x), 0, 0, 1, 1},
23964  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
23965  {&__pyx_n_s_rho, __pyx_k_rho, sizeof(__pyx_k_rho), 0, 0, 1, 1},
23966  {&__pyx_n_s_rho2, __pyx_k_rho2, sizeof(__pyx_k_rho2), 0, 0, 1, 1},
23967  {&__pyx_n_s_rhom, __pyx_k_rhom, sizeof(__pyx_k_rhom), 0, 0, 1, 1},
23968  {&__pyx_n_s_rotatingGaussianElementVelocityE, __pyx_k_rotatingGaussianElementVelocityE, sizeof(__pyx_k_rotatingGaussianElementVelocityE), 0, 0, 1, 1},
23969  {&__pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_k_rotatingGaussianElementVelocityE_2, sizeof(__pyx_k_rotatingGaussianElementVelocityE_2), 0, 0, 1, 1},
23970  {&__pyx_n_s_rowptr, __pyx_k_rowptr, sizeof(__pyx_k_rowptr), 0, 0, 1, 1},
23971  {&__pyx_n_s_sBar, __pyx_k_sBar, sizeof(__pyx_k_sBar), 0, 0, 1, 1},
23972  {&__pyx_n_s_setElementBoundariesArray, __pyx_k_setElementBoundariesArray, sizeof(__pyx_k_setElementBoundariesArray), 0, 0, 1, 1},
23973  {&__pyx_n_s_setExteriorElementBoundaryTypes, __pyx_k_setExteriorElementBoundaryTypes, sizeof(__pyx_k_setExteriorElementBoundaryTypes), 0, 0, 1, 1},
23974  {&__pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_k_setScalarMaterialFunctionOverEle, sizeof(__pyx_k_setScalarMaterialFunctionOverEle), 0, 0, 1, 1},
23975  {&__pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_k_setScalarMaterialFunctionOverEle_2, sizeof(__pyx_k_setScalarMaterialFunctionOverEle_2), 0, 0, 1, 1},
23976  {&__pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_k_setScalarMaterialFunctionOverGlo, sizeof(__pyx_k_setScalarMaterialFunctionOverGlo), 0, 0, 1, 1},
23977  {&__pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_k_setSparseTensorMaterialFunctionO, sizeof(__pyx_k_setSparseTensorMaterialFunctionO), 0, 0, 1, 1},
23978  {&__pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_k_setSparseTensorMaterialFunctionO_2, sizeof(__pyx_k_setSparseTensorMaterialFunctionO_2), 0, 0, 1, 1},
23979  {&__pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_k_setVectorMaterialFunctionOverEle, sizeof(__pyx_k_setVectorMaterialFunctionOverEle), 0, 0, 1, 1},
23980  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
23981  {&__pyx_n_s_sqrt_sBar, __pyx_k_sqrt_sBar, sizeof(__pyx_k_sqrt_sBar), 0, 0, 1, 1},
23982  {&__pyx_n_s_subsurfaceTransportFunctions, __pyx_k_subsurfaceTransportFunctions, sizeof(__pyx_k_subsurfaceTransportFunctions), 0, 0, 1, 1},
23983  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
23984  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
23985  {&__pyx_n_s_tForReversal, __pyx_k_tForReversal, sizeof(__pyx_k_tForReversal), 0, 0, 1, 1},
23986  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
23987  {&__pyx_n_s_thetaR, __pyx_k_thetaR, sizeof(__pyx_k_thetaR), 0, 0, 1, 1},
23988  {&__pyx_n_s_thetaS, __pyx_k_thetaS, sizeof(__pyx_k_thetaS), 0, 0, 1, 1},
23989  {&__pyx_n_s_thetaSR, __pyx_k_thetaSR, sizeof(__pyx_k_thetaSR), 0, 0, 1, 1},
23990  {&__pyx_n_s_thetaW, __pyx_k_thetaW, sizeof(__pyx_k_thetaW), 0, 0, 1, 1},
23991  {&__pyx_n_s_thisElementIsUpwind, __pyx_k_thisElementIsUpwind, sizeof(__pyx_k_thisElementIsUpwind), 0, 0, 1, 1},
23992  {&__pyx_n_s_transient, __pyx_k_transient, sizeof(__pyx_k_transient), 0, 0, 1, 1},
23993  {&__pyx_n_s_u_dof, __pyx_k_u_dof, sizeof(__pyx_k_u_dof), 0, 0, 1, 1},
23994  {&__pyx_n_s_u_eN, __pyx_k_u_eN, sizeof(__pyx_k_u_eN), 0, 0, 1, 1},
23995  {&__pyx_n_s_u_j, __pyx_k_u_j, sizeof(__pyx_k_u_j), 0, 0, 1, 1},
23996  {&__pyx_n_s_u_l2g, __pyx_k_u_l2g, sizeof(__pyx_k_u_l2g), 0, 0, 1, 1},
23997  {&__pyx_n_s_u_neig, __pyx_k_u_neig, sizeof(__pyx_k_u_neig), 0, 0, 1, 1},
23998  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
23999  {&__pyx_n_s_updateMassJacobian_weakAvg, __pyx_k_updateMassJacobian_weakAvg, sizeof(__pyx_k_updateMassJacobian_weakAvg), 0, 0, 1, 1},
24000  {&__pyx_n_s_updateMass_weakAvg, __pyx_k_updateMass_weakAvg, sizeof(__pyx_k_updateMass_weakAvg), 0, 0, 1, 1},
24001  {&__pyx_n_s_upwindFlag, __pyx_k_upwindFlag, sizeof(__pyx_k_upwindFlag), 0, 0, 1, 1},
24002  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
24003  {&__pyx_n_s_vBar, __pyx_k_vBar, sizeof(__pyx_k_vBar), 0, 0, 1, 1},
24004  {&__pyx_n_s_vBar2, __pyx_k_vBar2, sizeof(__pyx_k_vBar2), 0, 0, 1, 1},
24005  {&__pyx_n_s_vol, __pyx_k_vol, sizeof(__pyx_k_vol), 0, 0, 1, 1},
24006  {&__pyx_n_s_volFactor, __pyx_k_volFactor, sizeof(__pyx_k_volFactor), 0, 0, 1, 1},
24007  {&__pyx_n_s_vol_e, __pyx_k_vol_e, sizeof(__pyx_k_vol_e), 0, 0, 1, 1},
24008  {&__pyx_n_s_volume, __pyx_k_volume, sizeof(__pyx_k_volume), 0, 0, 1, 1},
24009  {&__pyx_n_s_vortexElementVelocityEval3, __pyx_k_vortexElementVelocityEval3, sizeof(__pyx_k_vortexElementVelocityEval3), 0, 0, 1, 1},
24010  {&__pyx_n_s_vortexElementVelocityEval4, __pyx_k_vortexElementVelocityEval4, sizeof(__pyx_k_vortexElementVelocityEval4), 0, 0, 1, 1},
24011  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
24012  {&__pyx_n_s_weak_residual, __pyx_k_weak_residual, sizeof(__pyx_k_weak_residual), 0, 0, 1, 1},
24013  {&__pyx_n_s_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 0, 1, 1},
24014  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
24015  {&__pyx_n_s_xc, __pyx_k_xc, sizeof(__pyx_k_xc), 0, 0, 1, 1},
24016  {&__pyx_n_s_yc, __pyx_k_yc, sizeof(__pyx_k_yc), 0, 0, 1, 1},
24017  {&__pyx_n_s_zVelocity, __pyx_k_zVelocity, sizeof(__pyx_k_zVelocity), 0, 0, 1, 1},
24018  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
24019  {&__pyx_n_s_zvelocity, __pyx_k_zvelocity, sizeof(__pyx_k_zvelocity), 0, 0, 1, 1},
24020  {0, 0, 0, 0, 0, 0, 0}
24021 };
24022 static int __Pyx_InitCachedBuiltins(void) {
24023  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 24, __pyx_L1_error)
24024  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 229, __pyx_L1_error)
24025  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 810, __pyx_L1_error)
24026  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1000, __pyx_L1_error)
24027  return 0;
24028  __pyx_L1_error:;
24029  return -1;
24030 }
24031 
24032 static int __Pyx_InitCachedConstants(void) {
24033  __Pyx_RefNannyDeclarations
24034  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
24035 
24036  /* "subsurfaceTransportFunctions.pyx":66
24037  * material = elementMaterialTypes[eN]
24038  * for k in range(q_vals.shape[1]):
24039  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
24040  *
24041  *
24042  */
24043  __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 66, __pyx_L1_error)
24044  __Pyx_GOTREF(__pyx_slice_);
24045  __Pyx_GIVEREF(__pyx_slice_);
24046 
24047  /* "subsurfaceTransportFunctions.pyx":192
24048  * material = elementMaterialTypes[eN]
24049  * for k in range(x.shape[1]):
24050  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat # <<<<<<<<<<<<<<
24051  *
24052  *
24053  */
24054  __pyx_slice__2 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 192, __pyx_L1_error)
24055  __Pyx_GOTREF(__pyx_slice__2);
24056  __Pyx_GIVEREF(__pyx_slice__2);
24057 
24058  /* "subsurfaceTransportFunctions.pyx":794
24059  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
24060  * v[eN,k,2]=zvelocity
24061  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
24062  * else:
24063  * for eN in range(x.shape[0]):
24064  */
24065  __pyx_slice__3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 794, __pyx_L1_error)
24066  __Pyx_GOTREF(__pyx_slice__3);
24067  __Pyx_GIVEREF(__pyx_slice__3);
24068 
24069  /* "subsurfaceTransportFunctions.pyx":808
24070  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
24071  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
24072  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
24073  * else:
24074  * for eN in range(x.shape[0]):
24075  */
24076  __pyx_slice__4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 808, __pyx_L1_error)
24077  __Pyx_GOTREF(__pyx_slice__4);
24078  __Pyx_GIVEREF(__pyx_slice__4);
24079 
24080  /* "subsurfaceTransportFunctions.pyx":835
24081  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
24082  * v[eN,ebN,k,2]=zvelocity
24083  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
24084  * else:
24085  * for eN in range(x.shape[0]):
24086  */
24087  __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(0, 835, __pyx_L1_error)
24088  __Pyx_GOTREF(__pyx_slice__5);
24089  __Pyx_GIVEREF(__pyx_slice__5);
24090 
24091  /* "subsurfaceTransportFunctions.pyx":851
24092  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
24093  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
24094  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
24095  * else:
24096  * for eN in range(x.shape[0]):
24097  */
24098  __pyx_slice__6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__6)) __PYX_ERR(0, 851, __pyx_L1_error)
24099  __Pyx_GOTREF(__pyx_slice__6);
24100  __Pyx_GIVEREF(__pyx_slice__6);
24101 
24102  /* "subsurfaceTransportFunctions.pyx":876
24103  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
24104  * v[eN,k,2]=zVelocity
24105  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
24106  * else:
24107  * for eN in range(x.shape[0]):
24108  */
24109  __pyx_slice__7 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 876, __pyx_L1_error)
24110  __Pyx_GOTREF(__pyx_slice__7);
24111  __Pyx_GIVEREF(__pyx_slice__7);
24112 
24113  /* "subsurfaceTransportFunctions.pyx":902
24114  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
24115  * v[eN,ebN,k,2]=zVelocity
24116  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
24117  * else:
24118  * for eN in range(x.shape[0]):
24119  */
24120  __pyx_slice__8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 902, __pyx_L1_error)
24121  __Pyx_GOTREF(__pyx_slice__8);
24122  __Pyx_GIVEREF(__pyx_slice__8);
24123 
24124  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229
24125  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
24126  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
24127  * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
24128  *
24129  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
24130  */
24131  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 229, __pyx_L1_error)
24132  __Pyx_GOTREF(__pyx_tuple__9);
24133  __Pyx_GIVEREF(__pyx_tuple__9);
24134 
24135  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233
24136  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
24137  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
24138  * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
24139  *
24140  * info.buf = PyArray_DATA(self)
24141  */
24142  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 233, __pyx_L1_error)
24143  __Pyx_GOTREF(__pyx_tuple__10);
24144  __Pyx_GIVEREF(__pyx_tuple__10);
24145 
24146  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263
24147  * if ((descr.byteorder == c'>' and little_endian) or
24148  * (descr.byteorder == c'<' and not little_endian)):
24149  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
24150  * if t == NPY_BYTE: f = "b"
24151  * elif t == NPY_UBYTE: f = "B"
24152  */
24153  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 263, __pyx_L1_error)
24154  __Pyx_GOTREF(__pyx_tuple__11);
24155  __Pyx_GIVEREF(__pyx_tuple__11);
24156 
24157  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":810
24158  *
24159  * if (end - f) - <int>(new_offset - offset[0]) < 15:
24160  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
24161  *
24162  * if ((child.byteorder == c'>' and little_endian) or
24163  */
24164  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 810, __pyx_L1_error)
24165  __Pyx_GOTREF(__pyx_tuple__12);
24166  __Pyx_GIVEREF(__pyx_tuple__12);
24167 
24168  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":814
24169  * if ((child.byteorder == c'>' and little_endian) or
24170  * (child.byteorder == c'<' and not little_endian)):
24171  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
24172  * # One could encode it in the format string and have Cython
24173  * # complain instead, BUT: < and > in format strings also imply
24174  */
24175  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 814, __pyx_L1_error)
24176  __Pyx_GOTREF(__pyx_tuple__13);
24177  __Pyx_GIVEREF(__pyx_tuple__13);
24178 
24179  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
24180  * t = child.type_num
24181  * if end - f < 5:
24182  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
24183  *
24184  * # Until ticket #99 is fixed, use integers to avoid warnings
24185  */
24186  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 834, __pyx_L1_error)
24187  __Pyx_GOTREF(__pyx_tuple__14);
24188  __Pyx_GIVEREF(__pyx_tuple__14);
24189 
24190  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000
24191  * _import_array()
24192  * except Exception:
24193  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
24194  *
24195  * cdef inline int import_umath() except -1:
24196  */
24197  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 1000, __pyx_L1_error)
24198  __Pyx_GOTREF(__pyx_tuple__15);
24199  __Pyx_GIVEREF(__pyx_tuple__15);
24200 
24201  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1006
24202  * _import_umath()
24203  * except Exception:
24204  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
24205  *
24206  * cdef inline int import_ufunc() except -1:
24207  */
24208  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 1006, __pyx_L1_error)
24209  __Pyx_GOTREF(__pyx_tuple__16);
24210  __Pyx_GIVEREF(__pyx_tuple__16);
24211 
24212  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1012
24213  * _import_umath()
24214  * except Exception:
24215  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
24216  */
24217  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 1012, __pyx_L1_error)
24218  __Pyx_GOTREF(__pyx_tuple__17);
24219  __Pyx_GIVEREF(__pyx_tuple__17);
24220 
24221  /* "subsurfaceTransportFunctions.pyx":18
24222  * ctypedef int ITYPE_t
24223  *
24224  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
24225  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
24226  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
24227  */
24228  __pyx_tuple__18 = PyTuple_Pack(8, __pyx_n_s_nExteriorElementBoundaries_globa, __pyx_n_s_exteriorElementBoundariesArray, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_n_s_ebNE, __pyx_n_s_ebN, __pyx_n_s_eN); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 18, __pyx_L1_error)
24229  __Pyx_GOTREF(__pyx_tuple__18);
24230  __Pyx_GIVEREF(__pyx_tuple__18);
24231  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setExteriorElementBoundaryTypes, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 18, __pyx_L1_error)
24232 
24233  /* "subsurfaceTransportFunctions.pyx":29
24234  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
24235  *
24236  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
24237  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
24238  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24239  */
24240  __pyx_tuple__20 = PyTuple_Pack(7, __pyx_n_s_nElementBoundaries_global, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_elementBoundaryMaterialTypes, __pyx_n_s_ebN, __pyx_n_s_eN_left, __pyx_n_s_eN_right); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 29, __pyx_L1_error)
24241  __Pyx_GOTREF(__pyx_tuple__20);
24242  __Pyx_GIVEREF(__pyx_tuple__20);
24243  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setElementBoundariesArray, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 29, __pyx_L1_error)
24244 
24245  /* "subsurfaceTransportFunctions.pyx":43
24246  *
24247  * ###
24248  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
24249  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
24250  * dict material_functions):
24251  */
24252  __pyx_tuple__22 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 43, __pyx_L1_error)
24253  __Pyx_GOTREF(__pyx_tuple__22);
24254  __Pyx_GIVEREF(__pyx_tuple__22);
24255  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverEle, 43, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 43, __pyx_L1_error)
24256 
24257  /* "subsurfaceTransportFunctions.pyx":56
24258  * q_vals[eN,k] = material_functions[material]
24259  *
24260  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
24261  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
24262  * dict material_functions):
24263  */
24264  __pyx_tuple__24 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 56, __pyx_L1_error)
24265  __Pyx_GOTREF(__pyx_tuple__24);
24266  __Pyx_GIVEREF(__pyx_tuple__24);
24267  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setVectorMaterialFunctionOverEle, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 56, __pyx_L1_error)
24268 
24269  /* "subsurfaceTransportFunctions.pyx":69
24270  *
24271  *
24272  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
24273  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24274  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
24275  */
24276  __pyx_tuple__26 = PyTuple_Pack(10, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 69, __pyx_L1_error)
24277  __Pyx_GOTREF(__pyx_tuple__26);
24278  __Pyx_GIVEREF(__pyx_tuple__26);
24279  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverEle_2, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 69, __pyx_L1_error)
24280 
24281  /* "subsurfaceTransportFunctions.pyx":91
24282  * material_functions[material_right])
24283  *
24284  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24285  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24286  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24287  */
24288  __pyx_tuple__28 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 91, __pyx_L1_error)
24289  __Pyx_GOTREF(__pyx_tuple__28);
24290  __Pyx_GIVEREF(__pyx_tuple__28);
24291  __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setSparseTensorMaterialFunctionO, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 91, __pyx_L1_error)
24292 
24293  /* "subsurfaceTransportFunctions.pyx":118
24294  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
24295  *
24296  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
24297  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24298  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
24299  */
24300  __pyx_tuple__30 = PyTuple_Pack(8, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 118, __pyx_L1_error)
24301  __Pyx_GOTREF(__pyx_tuple__30);
24302  __Pyx_GIVEREF(__pyx_tuple__30);
24303  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverGlo, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 118, __pyx_L1_error)
24304 
24305  /* "subsurfaceTransportFunctions.pyx":139
24306  *
24307  *
24308  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24309  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24310  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24311  */
24312  __pyx_tuple__32 = PyTuple_Pack(13, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 139, __pyx_L1_error)
24313  __Pyx_GOTREF(__pyx_tuple__32);
24314  __Pyx_GIVEREF(__pyx_tuple__32);
24315  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setSparseTensorMaterialFunctionO_2, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 139, __pyx_L1_error)
24316 
24317  /* "subsurfaceTransportFunctions.pyx":165
24318  *
24319  * ###
24320  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
24321  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24322  * numpy.ndarray[DTYPE_t,ndim=3] x,
24323  */
24324  __pyx_tuple__34 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 165, __pyx_L1_error)
24325  __Pyx_GOTREF(__pyx_tuple__34);
24326  __Pyx_GIVEREF(__pyx_tuple__34);
24327  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 165, __pyx_L1_error)
24328 
24329  /* "subsurfaceTransportFunctions.pyx":180
24330  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
24331  *
24332  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
24333  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24334  * numpy.ndarray[DTYPE_t,ndim=3] x,
24335  */
24336  __pyx_tuple__36 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 180, __pyx_L1_error)
24337  __Pyx_GOTREF(__pyx_tuple__36);
24338  __Pyx_GIVEREF(__pyx_tuple__36);
24339  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateVectorMaterialFunctionOv, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 180, __pyx_L1_error)
24340 
24341  /* "subsurfaceTransportFunctions.pyx":195
24342  *
24343  *
24344  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
24345  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24346  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24347  */
24348  __pyx_tuple__38 = PyTuple_Pack(12, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 195, __pyx_L1_error)
24349  __Pyx_GOTREF(__pyx_tuple__38);
24350  __Pyx_GIVEREF(__pyx_tuple__38);
24351  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 195, __pyx_L1_error)
24352 
24353  /* "subsurfaceTransportFunctions.pyx":219
24354  * material_functions[material_right](x[eN,ebN_local,k],t))
24355  *
24356  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24357  * double t,
24358  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24359  */
24360  __pyx_tuple__40 = PyTuple_Pack(17, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 219, __pyx_L1_error)
24361  __Pyx_GOTREF(__pyx_tuple__40);
24362  __Pyx_GIVEREF(__pyx_tuple__40);
24363  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(7, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateSparseTensorMaterialFunc, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 219, __pyx_L1_error)
24364 
24365  /* "subsurfaceTransportFunctions.pyx":248
24366  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
24367  *
24368  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
24369  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24370  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24371  */
24372  __pyx_tuple__42 = PyTuple_Pack(10, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 248, __pyx_L1_error)
24373  __Pyx_GOTREF(__pyx_tuple__42);
24374  __Pyx_GIVEREF(__pyx_tuple__42);
24375  __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, 248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 248, __pyx_L1_error)
24376 
24377  /* "subsurfaceTransportFunctions.pyx":271
24378  *
24379  *
24380  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24381  * double t,
24382  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24383  */
24384  __pyx_tuple__44 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 271, __pyx_L1_error)
24385  __Pyx_GOTREF(__pyx_tuple__44);
24386  __Pyx_GIVEREF(__pyx_tuple__44);
24387  __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(7, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, 271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 271, __pyx_L1_error)
24388 
24389  /* "subsurfaceTransportFunctions.pyx":301
24390  *
24391  * ##################################################
24392  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
24393  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
24394  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24395  */
24396  __pyx_tuple__46 = PyTuple_Pack(24, __pyx_n_s_rho, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_KWs, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_ebN, __pyx_n_s_matID, __pyx_n_s_matID_neig, __pyx_n_s_nSpace2, __pyx_n_s_nnz, __pyx_n_s_a_eN, __pyx_n_s_a_neig, __pyx_n_s_a_avg); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 301, __pyx_L1_error)
24397  __Pyx_GOTREF(__pyx_tuple__46);
24398  __Pyx_GIVEREF(__pyx_tuple__46);
24399  __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(12, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, 301, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 301, __pyx_L1_error)
24400 
24401  /* "subsurfaceTransportFunctions.pyx":359
24402  *
24403  *
24404  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
24405  * double beta,
24406  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
24407  */
24408  __pyx_tuple__48 = PyTuple_Pack(61, __pyx_n_s_rho, __pyx_n_s_beta, __pyx_n_s_gravity, __pyx_n_s_alpha, __pyx_n_s_n, __pyx_n_s_thetaR, __pyx_n_s_thetaSR, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_nDOF_trial_element, __pyx_n_s_u_l2g, __pyx_n_s_u_dof, __pyx_n_s_q_x, __pyx_n_s_q_u, __pyx_n_s_q_mass, __pyx_n_s_q_dmass, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q, __pyx_n_s_psiC, __pyx_n_s_pcBar, __pyx_n_s_pcBar_n, __pyx_n_s_pcBar_nM1, __pyx_n_s_pcBar_nM2, __pyx_n_s_onePlus_pcBar_n, __pyx_n_s_sBar, __pyx_n_s_sqrt_sBar, __pyx_n_s_DsBar_DpsiC, __pyx_n_s_thetaW, __pyx_n_s_DthetaW_DpsiC, __pyx_n_s_vBar, __pyx_n_s_vBar2, __pyx_n_s_DvBar_DpsiC, __pyx_n_s_KWr, __pyx_n_s_DKWr_DpsiC, __pyx_n_s_rho2, __pyx_n_s_thetaS, __pyx_n_s_rhom, __pyx_n_s_drhom, __pyx_n_s_m, __pyx_n_s_u_j, __pyx_n_s_u_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_eN, __pyx_n_s_kr_neig, __pyx_n_s_phi_eN, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ebN, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_j, __pyx_n_s_matID, __pyx_n_s_nAvgWeight); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 359, __pyx_L1_error)
24409  __Pyx_GOTREF(__pyx_tuple__48);
24410  __Pyx_GIVEREF(__pyx_tuple__48);
24411  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(24, 0, 61, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 359, __pyx_L1_error)
24412 
24413  /* "subsurfaceTransportFunctions.pyx":486
24414  * #eN for upwind
24415  *
24416  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
24417  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24418  * numpy.ndarray[ITYPE_t,ndim=1] colind,
24419  */
24420  __pyx_tuple__50 = PyTuple_Pack(42, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_mt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementResidual, __pyx_n_s_upwindFlag, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_volume); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 486, __pyx_L1_error)
24421  __Pyx_GOTREF(__pyx_tuple__50);
24422  __Pyx_GIVEREF(__pyx_tuple__50);
24423  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(21, 0, 42, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_getElementResidual, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 486, __pyx_L1_error)
24424 
24425  /* "subsurfaceTransportFunctions.pyx":574
24426  * #i
24427  * #eN
24428  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
24429  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24430  * numpy.ndarray[ITYPE_t,ndim=1] colind,
24431  */
24432  __pyx_tuple__52 = PyTuple_Pack(51, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_nDOF_trial_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_grad_v, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_dm, __pyx_n_s_q_mt, __pyx_n_s_q_dmt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementJacobian, __pyx_n_s_upwindFlag, __pyx_n_s_picard, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_dkr_up, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_thisElementIsUpwind, __pyx_n_s_volume, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_j); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 574, __pyx_L1_error)
24433  __Pyx_GOTREF(__pyx_tuple__52);
24434  __Pyx_GIVEREF(__pyx_tuple__52);
24435  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(26, 0, 51, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_getElementJacobian, 574, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 574, __pyx_L1_error)
24436 
24437  /* "subsurfaceTransportFunctions.pyx":673
24438  * ##################################################
24439  *
24440  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
24441  * numpy.ndarray[DTYPE_t,ndim=3] w,
24442  * numpy.ndarray[DTYPE_t,ndim=2] dV,
24443  */
24444  __pyx_tuple__54 = PyTuple_Pack(9, __pyx_n_s_mt, __pyx_n_s_w, __pyx_n_s_dV, __pyx_n_s_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_mt_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 673, __pyx_L1_error)
24445  __Pyx_GOTREF(__pyx_tuple__54);
24446  __Pyx_GIVEREF(__pyx_tuple__54);
24447  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_updateMass_weakAvg, 673, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 673, __pyx_L1_error)
24448 
24449  /* "subsurfaceTransportFunctions.pyx":692
24450  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
24451  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
24452  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
24453  * numpy.ndarray[DTYPE_t,ndim=3] w,
24454  * numpy.ndarray[DTYPE_t,ndim=3] v,
24455  */
24456  __pyx_tuple__56 = PyTuple_Pack(11, __pyx_n_s_dmt, __pyx_n_s_w, __pyx_n_s_v, __pyx_n_s_dV, __pyx_n_s_jacobian_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_dmtj_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 692, __pyx_L1_error)
24457  __Pyx_GOTREF(__pyx_tuple__56);
24458  __Pyx_GIVEREF(__pyx_tuple__56);
24459  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_updateMassJacobian_weakAvg, 692, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 692, __pyx_L1_error)
24460 
24461  /* "subsurfaceTransportFunctions.pyx":717
24462  * #ELLAM
24463  * ########################################################################
24464  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
24465  * numpy.ndarray[DTYPE_t,ndim=4] n,
24466  * numpy.ndarray[DTYPE_t,ndim=3] dS,
24467  */
24468  __pyx_tuple__58 = PyTuple_Pack(9, __pyx_n_s_v, __pyx_n_s_n, __pyx_n_s_dS, __pyx_n_s_flux, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_kb, __pyx_n_s_integral, __pyx_n_s_I); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 717, __pyx_L1_error)
24469  __Pyx_GOTREF(__pyx_tuple__58);
24470  __Pyx_GIVEREF(__pyx_tuple__58);
24471  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_calculateNormalFlux, 717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 717, __pyx_L1_error)
24472 
24473  /* "subsurfaceTransportFunctions.pyx":732
24474  * flux[eN,ebN] = integral
24475  *
24476  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
24477  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
24478  * numpy.ndarray[DTYPE_t,ndim=2] dm,
24479  */
24480  __pyx_tuple__60 = PyTuple_Pack(9, __pyx_n_s_df, __pyx_n_s_characteristic_velocity, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_I, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 732, __pyx_L1_error)
24481  __Pyx_GOTREF(__pyx_tuple__60);
24482  __Pyx_GIVEREF(__pyx_tuple__60);
24483  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_computeSimpleCharacteristicVeloc, 732, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 732, __pyx_L1_error)
24484 
24485  /* "subsurfaceTransportFunctions.pyx":753
24486  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
24487  *
24488  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
24489  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
24490  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
24491  */
24492  __pyx_tuple__62 = PyTuple_Pack(11, __pyx_n_s_df_dofs, __pyx_n_s_characteristic_velocity_dofs, __pyx_n_s_l2g, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_j, __pyx_n_s_J, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 753, __pyx_L1_error)
24493  __Pyx_GOTREF(__pyx_tuple__62);
24494  __Pyx_GIVEREF(__pyx_tuple__62);
24495  __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_computeSimpleCharacteristicVeloc_2, 753, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 753, __pyx_L1_error)
24496 
24497  /* "subsurfaceTransportFunctions.pyx":776
24498  *
24499  * #problem specific velocity evaluation
24500  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
24501  * double t,
24502  * double tForReversal,
24503  */
24504  __pyx_tuple__64 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 776, __pyx_L1_error)
24505  __Pyx_GOTREF(__pyx_tuple__64);
24506  __Pyx_GIVEREF(__pyx_tuple__64);
24507  __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_rotatingGaussianElementVelocityE, 776, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 776, __pyx_L1_error)
24508 
24509  /* "subsurfaceTransportFunctions.pyx":816
24510  *
24511  *
24512  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
24513  * double t,
24514  * double tForReversal,
24515  */
24516  __pyx_tuple__66 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 816, __pyx_L1_error)
24517  __Pyx_GOTREF(__pyx_tuple__66);
24518  __Pyx_GIVEREF(__pyx_tuple__66);
24519  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_rotatingGaussianElementVelocityE_2, 816, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 816, __pyx_L1_error)
24520 
24521  /* "subsurfaceTransportFunctions.pyx":859
24522  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
24523  *
24524  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
24525  * double t,
24526  * double tForReversal,
24527  */
24528  __pyx_tuple__68 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 859, __pyx_L1_error)
24529  __Pyx_GOTREF(__pyx_tuple__68);
24530  __Pyx_GIVEREF(__pyx_tuple__68);
24531  __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_helicalElementVelocityEval3, 859, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 859, __pyx_L1_error)
24532 
24533  /* "subsurfaceTransportFunctions.pyx":884
24534  * v[eN,k,2]=zVelocity
24535  *
24536  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
24537  * double t,
24538  * double tForReversal,
24539  */
24540  __pyx_tuple__70 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 884, __pyx_L1_error)
24541  __Pyx_GOTREF(__pyx_tuple__70);
24542  __Pyx_GIVEREF(__pyx_tuple__70);
24543  __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_helicalElementVelocityEval4, 884, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 884, __pyx_L1_error)
24544 
24545  /* "subsurfaceTransportFunctions.pyx":911
24546  * v[eN,ebN,k,2]=zVelocity
24547  *
24548  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
24549  * numpy.ndarray[DTYPE_t,ndim=3] x,
24550  * numpy.ndarray[DTYPE_t,ndim=3] v):
24551  */
24552  __pyx_tuple__72 = PyTuple_Pack(7, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 911, __pyx_L1_error)
24553  __Pyx_GOTREF(__pyx_tuple__72);
24554  __Pyx_GIVEREF(__pyx_tuple__72);
24555  __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_vortexElementVelocityEval3, 911, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 911, __pyx_L1_error)
24556 
24557  /* "subsurfaceTransportFunctions.pyx":924
24558  *
24559  *
24560  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
24561  * numpy.ndarray[DTYPE_t,ndim=4] x,
24562  * numpy.ndarray[DTYPE_t,ndim=4] v):
24563  */
24564  __pyx_tuple__74 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_ebN, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 924, __pyx_L1_error)
24565  __Pyx_GOTREF(__pyx_tuple__74);
24566  __Pyx_GIVEREF(__pyx_tuple__74);
24567  __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_vortexElementVelocityEval4, 924, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 924, __pyx_L1_error)
24568  __Pyx_RefNannyFinishContext();
24569  return 0;
24570  __pyx_L1_error:;
24571  __Pyx_RefNannyFinishContext();
24572  return -1;
24573 }
24574 
24575 static int __Pyx_InitGlobals(void) {
24576  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
24577  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
24578  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
24579  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
24580  __pyx_float_1_0eneg_20 = PyFloat_FromDouble(1.0e-20); if (unlikely(!__pyx_float_1_0eneg_20)) __PYX_ERR(0, 1, __pyx_L1_error)
24581  return 0;
24582  __pyx_L1_error:;
24583  return -1;
24584 }
24585 
24586 static int __Pyx_modinit_global_init_code(void); /*proto*/
24587 static int __Pyx_modinit_variable_export_code(void); /*proto*/
24588 static int __Pyx_modinit_function_export_code(void); /*proto*/
24589 static int __Pyx_modinit_type_init_code(void); /*proto*/
24590 static int __Pyx_modinit_type_import_code(void); /*proto*/
24591 static int __Pyx_modinit_variable_import_code(void); /*proto*/
24592 static int __Pyx_modinit_function_import_code(void); /*proto*/
24593 
24594 static int __Pyx_modinit_global_init_code(void) {
24595  __Pyx_RefNannyDeclarations
24596  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
24597  /*--- Global init code ---*/
24598  __Pyx_RefNannyFinishContext();
24599  return 0;
24600 }
24601 
24602 static int __Pyx_modinit_variable_export_code(void) {
24603  __Pyx_RefNannyDeclarations
24604  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
24605  /*--- Variable export code ---*/
24606  __Pyx_RefNannyFinishContext();
24607  return 0;
24608 }
24609 
24610 static int __Pyx_modinit_function_export_code(void) {
24611  __Pyx_RefNannyDeclarations
24612  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
24613  /*--- Function export code ---*/
24614  __Pyx_RefNannyFinishContext();
24615  return 0;
24616 }
24617 
24618 static int __Pyx_modinit_type_init_code(void) {
24619  __Pyx_RefNannyDeclarations
24620  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
24621  /*--- Type init code ---*/
24622  __Pyx_RefNannyFinishContext();
24623  return 0;
24624 }
24625 
24626 static int __Pyx_modinit_type_import_code(void) {
24627  __Pyx_RefNannyDeclarations
24628  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
24629  /*--- Type import code ---*/
24630  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
24631  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
24632  sizeof(PyTypeObject),
24633  #else
24634  sizeof(PyHeapTypeObject),
24635  #endif
24636  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error)
24637  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 164, __pyx_L1_error)
24638  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 186, __pyx_L1_error)
24639  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 190, __pyx_L1_error)
24640  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 199, __pyx_L1_error)
24641  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 872, __pyx_L1_error)
24642  __Pyx_RefNannyFinishContext();
24643  return 0;
24644  __pyx_L1_error:;
24645  __Pyx_RefNannyFinishContext();
24646  return -1;
24647 }
24648 
24649 static int __Pyx_modinit_variable_import_code(void) {
24650  __Pyx_RefNannyDeclarations
24651  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
24652  /*--- Variable import code ---*/
24653  __Pyx_RefNannyFinishContext();
24654  return 0;
24655 }
24656 
24657 static int __Pyx_modinit_function_import_code(void) {
24658  __Pyx_RefNannyDeclarations
24659  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
24660  /*--- Function import code ---*/
24661  __Pyx_RefNannyFinishContext();
24662  return 0;
24663 }
24664 
24665 
24666 #if PY_MAJOR_VERSION < 3
24667 #ifdef CYTHON_NO_PYINIT_EXPORT
24668 #define __Pyx_PyMODINIT_FUNC void
24669 #else
24670 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
24671 #endif
24672 #else
24673 #ifdef CYTHON_NO_PYINIT_EXPORT
24674 #define __Pyx_PyMODINIT_FUNC PyObject *
24675 #else
24676 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
24677 #endif
24678 #endif
24679 #ifndef CYTHON_SMALL_CODE
24680 #if defined(__clang__)
24681  #define CYTHON_SMALL_CODE
24682 #elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)))
24683  #define CYTHON_SMALL_CODE __attribute__((cold))
24684 #else
24685  #define CYTHON_SMALL_CODE
24686 #endif
24687 #endif
24688 
24689 
24690 #if PY_MAJOR_VERSION < 3
24691 __Pyx_PyMODINIT_FUNC initsubsurfaceTransportFunctions(void) CYTHON_SMALL_CODE; /*proto*/
24692 __Pyx_PyMODINIT_FUNC initsubsurfaceTransportFunctions(void)
24693 #else
24694 __Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void) CYTHON_SMALL_CODE; /*proto*/
24695 __Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)
24696 #if CYTHON_PEP489_MULTI_PHASE_INIT
24697 {
24698  return PyModuleDef_Init(&__pyx_moduledef);
24699 }
24700 static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) {
24701  PyObject *value = PyObject_GetAttrString(spec, from_name);
24702  int result = 0;
24703  if (likely(value)) {
24704  result = PyDict_SetItemString(moddict, to_name, value);
24705  Py_DECREF(value);
24706  } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
24707  PyErr_Clear();
24708  } else {
24709  result = -1;
24710  }
24711  return result;
24712 }
24713 static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
24714  PyObject *module = NULL, *moddict, *modname;
24715  if (__pyx_m)
24716  return __Pyx_NewRef(__pyx_m);
24717  modname = PyObject_GetAttrString(spec, "name");
24718  if (unlikely(!modname)) goto bad;
24719  module = PyModule_NewObject(modname);
24720  Py_DECREF(modname);
24721  if (unlikely(!module)) goto bad;
24722  moddict = PyModule_GetDict(module);
24723  if (unlikely(!moddict)) goto bad;
24724  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad;
24725  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad;
24726  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad;
24727  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad;
24728  return module;
24729 bad:
24730  Py_XDECREF(module);
24731  return NULL;
24732 }
24733 
24734 
24735 static int __pyx_pymod_exec_subsurfaceTransportFunctions(PyObject *__pyx_pyinit_module)
24736 #endif
24737 #endif
24738 {
24739  PyObject *__pyx_t_1 = NULL;
24740  __Pyx_RefNannyDeclarations
24741  #if CYTHON_PEP489_MULTI_PHASE_INIT
24742  if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0;
24743  #elif PY_MAJOR_VERSION >= 3
24744  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
24745  #endif
24746  #if CYTHON_REFNANNY
24747 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
24748 if (!__Pyx_RefNanny) {
24749  PyErr_Clear();
24750  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
24751  if (!__Pyx_RefNanny)
24752  Py_FatalError("failed to import 'refnanny' module");
24753 }
24754 #endif
24755  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)", 0);
24756  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24757  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
24758  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
24759  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
24760  #ifdef __Pyx_CyFunction_USED
24761  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24762  #endif
24763  #ifdef __Pyx_FusedFunction_USED
24764  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24765  #endif
24766  #ifdef __Pyx_Coroutine_USED
24767  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24768  #endif
24769  #ifdef __Pyx_Generator_USED
24770  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24771  #endif
24772  #ifdef __Pyx_AsyncGen_USED
24773  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24774  #endif
24775  #ifdef __Pyx_StopAsyncIteration_USED
24776  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24777  #endif
24778  /*--- Library function declarations ---*/
24779  /*--- Threads initialization code ---*/
24780  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
24781  #ifdef WITH_THREAD /* Python build with threading support? */
24782  PyEval_InitThreads();
24783  #endif
24784  #endif
24785  /*--- Module creation code ---*/
24786  #if CYTHON_PEP489_MULTI_PHASE_INIT
24787  __pyx_m = __pyx_pyinit_module;
24788  Py_INCREF(__pyx_m);
24789  #else
24790  #if PY_MAJOR_VERSION < 3
24791  __pyx_m = Py_InitModule4("subsurfaceTransportFunctions", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
24792  #else
24793  __pyx_m = PyModule_Create(&__pyx_moduledef);
24794  #endif
24795  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
24796  #endif
24797  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
24798  Py_INCREF(__pyx_d);
24799  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
24800  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
24801  #if CYTHON_COMPILING_IN_PYPY
24802  Py_INCREF(__pyx_b);
24803  #endif
24804  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
24805  /*--- Initialize various global constants etc. ---*/
24806  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24807  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
24808  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24809  #endif
24810  if (__pyx_module_is_main_subsurfaceTransportFunctions) {
24811  if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24812  }
24813  #if PY_MAJOR_VERSION >= 3
24814  {
24815  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
24816  if (!PyDict_GetItemString(modules, "subsurfaceTransportFunctions")) {
24817  if (unlikely(PyDict_SetItemString(modules, "subsurfaceTransportFunctions", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
24818  }
24819  }
24820  #endif
24821  /*--- Builtin init code ---*/
24822  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24823  /*--- Constants init code ---*/
24824  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24825  /*--- Global type/function init code ---*/
24826  (void)__Pyx_modinit_global_init_code();
24827  (void)__Pyx_modinit_variable_export_code();
24828  (void)__Pyx_modinit_function_export_code();
24829  (void)__Pyx_modinit_type_init_code();
24830  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
24831  (void)__Pyx_modinit_variable_import_code();
24832  (void)__Pyx_modinit_function_import_code();
24833  /*--- Execution code ---*/
24834  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
24835  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24836  #endif
24837 
24838  /* "subsurfaceTransportFunctions.pyx":1
24839  * import numpy # <<<<<<<<<<<<<<
24840  * cimport numpy
24841  * cdef extern from "math.h":
24842  */
24843  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
24844  __Pyx_GOTREF(__pyx_t_1);
24845  if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24846  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24847 
24848  /* "subsurfaceTransportFunctions.pyx":18
24849  * ctypedef int ITYPE_t
24850  *
24851  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
24852  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
24853  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
24854  */
24855  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
24856  __Pyx_GOTREF(__pyx_t_1);
24857  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setExteriorElementBoundaryTypes, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
24858  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24859 
24860  /* "subsurfaceTransportFunctions.pyx":29
24861  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
24862  *
24863  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
24864  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
24865  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24866  */
24867  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
24868  __Pyx_GOTREF(__pyx_t_1);
24869  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setElementBoundariesArray, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
24870  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24871 
24872  /* "subsurfaceTransportFunctions.pyx":43
24873  *
24874  * ###
24875  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
24876  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
24877  * dict material_functions):
24878  */
24879  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
24880  __Pyx_GOTREF(__pyx_t_1);
24881  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
24882  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24883 
24884  /* "subsurfaceTransportFunctions.pyx":56
24885  * q_vals[eN,k] = material_functions[material]
24886  *
24887  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
24888  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
24889  * dict material_functions):
24890  */
24891  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
24892  __Pyx_GOTREF(__pyx_t_1);
24893  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
24894  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24895 
24896  /* "subsurfaceTransportFunctions.pyx":69
24897  *
24898  *
24899  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
24900  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24901  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
24902  */
24903  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
24904  __Pyx_GOTREF(__pyx_t_1);
24905  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_t_1) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
24906  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24907 
24908  /* "subsurfaceTransportFunctions.pyx":91
24909  * material_functions[material_right])
24910  *
24911  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24912  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24913  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24914  */
24915  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
24916  __Pyx_GOTREF(__pyx_t_1);
24917  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
24918  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24919 
24920  /* "subsurfaceTransportFunctions.pyx":118
24921  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
24922  *
24923  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
24924  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24925  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
24926  */
24927  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
24928  __Pyx_GOTREF(__pyx_t_1);
24929  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_t_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error)
24930  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24931 
24932  /* "subsurfaceTransportFunctions.pyx":139
24933  *
24934  *
24935  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24936  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24937  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24938  */
24939  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
24940  __Pyx_GOTREF(__pyx_t_1);
24941  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_t_1) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
24942  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24943 
24944  /* "subsurfaceTransportFunctions.pyx":165
24945  *
24946  * ###
24947  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
24948  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24949  * numpy.ndarray[DTYPE_t,ndim=3] x,
24950  */
24951  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
24952  __Pyx_GOTREF(__pyx_t_1);
24953  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
24954  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24955 
24956  /* "subsurfaceTransportFunctions.pyx":180
24957  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
24958  *
24959  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
24960  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24961  * numpy.ndarray[DTYPE_t,ndim=3] x,
24962  */
24963  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
24964  __Pyx_GOTREF(__pyx_t_1);
24965  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
24966  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24967 
24968  /* "subsurfaceTransportFunctions.pyx":195
24969  *
24970  *
24971  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
24972  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24973  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24974  */
24975  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
24976  __Pyx_GOTREF(__pyx_t_1);
24977  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_t_1) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
24978  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24979 
24980  /* "subsurfaceTransportFunctions.pyx":219
24981  * material_functions[material_right](x[eN,ebN_local,k],t))
24982  *
24983  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24984  * double t,
24985  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24986  */
24987  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
24988  __Pyx_GOTREF(__pyx_t_1);
24989  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_t_1) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
24990  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24991 
24992  /* "subsurfaceTransportFunctions.pyx":248
24993  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
24994  *
24995  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
24996  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24997  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24998  */
24999  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
25000  __Pyx_GOTREF(__pyx_t_1);
25001  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_t_1) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
25002  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25003 
25004  /* "subsurfaceTransportFunctions.pyx":271
25005  *
25006  *
25007  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
25008  * double t,
25009  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
25010  */
25011  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
25012  __Pyx_GOTREF(__pyx_t_1);
25013  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_t_1) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
25014  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25015 
25016  /* "subsurfaceTransportFunctions.pyx":301
25017  *
25018  * ##################################################
25019  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
25020  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
25021  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
25022  */
25023  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
25024  __Pyx_GOTREF(__pyx_t_1);
25025  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_t_1) < 0) __PYX_ERR(0, 301, __pyx_L1_error)
25026  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25027 
25028  /* "subsurfaceTransportFunctions.pyx":359
25029  *
25030  *
25031  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
25032  * double beta,
25033  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
25034  */
25035  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error)
25036  __Pyx_GOTREF(__pyx_t_1);
25037  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_t_1) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
25038  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25039 
25040  /* "subsurfaceTransportFunctions.pyx":486
25041  * #eN for upwind
25042  *
25043  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
25044  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
25045  * numpy.ndarray[ITYPE_t,ndim=1] colind,
25046  */
25047  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
25048  __Pyx_GOTREF(__pyx_t_1);
25049  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementResidual, __pyx_t_1) < 0) __PYX_ERR(0, 486, __pyx_L1_error)
25050  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25051 
25052  /* "subsurfaceTransportFunctions.pyx":574
25053  * #i
25054  * #eN
25055  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
25056  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
25057  * numpy.ndarray[ITYPE_t,ndim=1] colind,
25058  */
25059  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
25060  __Pyx_GOTREF(__pyx_t_1);
25061  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementJacobian, __pyx_t_1) < 0) __PYX_ERR(0, 574, __pyx_L1_error)
25062  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25063 
25064  /* "subsurfaceTransportFunctions.pyx":673
25065  * ##################################################
25066  *
25067  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
25068  * numpy.ndarray[DTYPE_t,ndim=3] w,
25069  * numpy.ndarray[DTYPE_t,ndim=2] dV,
25070  */
25071  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error)
25072  __Pyx_GOTREF(__pyx_t_1);
25073  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMass_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 673, __pyx_L1_error)
25074  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25075 
25076  /* "subsurfaceTransportFunctions.pyx":692
25077  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
25078  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
25079  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
25080  * numpy.ndarray[DTYPE_t,ndim=3] w,
25081  * numpy.ndarray[DTYPE_t,ndim=3] v,
25082  */
25083  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error)
25084  __Pyx_GOTREF(__pyx_t_1);
25085  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMassJacobian_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 692, __pyx_L1_error)
25086  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25087 
25088  /* "subsurfaceTransportFunctions.pyx":717
25089  * #ELLAM
25090  * ########################################################################
25091  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
25092  * numpy.ndarray[DTYPE_t,ndim=4] n,
25093  * numpy.ndarray[DTYPE_t,ndim=3] dS,
25094  */
25095  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
25096  __Pyx_GOTREF(__pyx_t_1);
25097  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNormalFlux, __pyx_t_1) < 0) __PYX_ERR(0, 717, __pyx_L1_error)
25098  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25099 
25100  /* "subsurfaceTransportFunctions.pyx":732
25101  * flux[eN,ebN] = integral
25102  *
25103  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
25104  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
25105  * numpy.ndarray[DTYPE_t,ndim=2] dm,
25106  */
25107  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
25108  __Pyx_GOTREF(__pyx_t_1);
25109  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_t_1) < 0) __PYX_ERR(0, 732, __pyx_L1_error)
25110  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25111 
25112  /* "subsurfaceTransportFunctions.pyx":753
25113  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
25114  *
25115  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
25116  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
25117  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
25118  */
25119  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
25120  __Pyx_GOTREF(__pyx_t_1);
25121  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_t_1) < 0) __PYX_ERR(0, 753, __pyx_L1_error)
25122  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25123 
25124  /* "subsurfaceTransportFunctions.pyx":776
25125  *
25126  * #problem specific velocity evaluation
25127  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
25128  * double t,
25129  * double tForReversal,
25130  */
25131  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
25132  __Pyx_GOTREF(__pyx_t_1);
25133  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE, __pyx_t_1) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
25134  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25135 
25136  /* "subsurfaceTransportFunctions.pyx":816
25137  *
25138  *
25139  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
25140  * double t,
25141  * double tForReversal,
25142  */
25143  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L1_error)
25144  __Pyx_GOTREF(__pyx_t_1);
25145  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_t_1) < 0) __PYX_ERR(0, 816, __pyx_L1_error)
25146  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25147 
25148  /* "subsurfaceTransportFunctions.pyx":859
25149  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
25150  *
25151  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
25152  * double t,
25153  * double tForReversal,
25154  */
25155  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error)
25156  __Pyx_GOTREF(__pyx_t_1);
25157  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 859, __pyx_L1_error)
25158  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25159 
25160  /* "subsurfaceTransportFunctions.pyx":884
25161  * v[eN,k,2]=zVelocity
25162  *
25163  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
25164  * double t,
25165  * double tForReversal,
25166  */
25167  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
25168  __Pyx_GOTREF(__pyx_t_1);
25169  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 884, __pyx_L1_error)
25170  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25171 
25172  /* "subsurfaceTransportFunctions.pyx":911
25173  * v[eN,ebN,k,2]=zVelocity
25174  *
25175  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
25176  * numpy.ndarray[DTYPE_t,ndim=3] x,
25177  * numpy.ndarray[DTYPE_t,ndim=3] v):
25178  */
25179  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
25180  __Pyx_GOTREF(__pyx_t_1);
25181  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 911, __pyx_L1_error)
25182  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25183 
25184  /* "subsurfaceTransportFunctions.pyx":924
25185  *
25186  *
25187  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
25188  * numpy.ndarray[DTYPE_t,ndim=4] x,
25189  * numpy.ndarray[DTYPE_t,ndim=4] v):
25190  */
25191  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
25192  __Pyx_GOTREF(__pyx_t_1);
25193  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 924, __pyx_L1_error)
25194  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25195 
25196  /* "subsurfaceTransportFunctions.pyx":1
25197  * import numpy # <<<<<<<<<<<<<<
25198  * cimport numpy
25199  * cdef extern from "math.h":
25200  */
25201  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
25202  __Pyx_GOTREF(__pyx_t_1);
25203  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25204  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25205 
25206  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1008
25207  * raise ImportError("numpy.core.umath failed to import")
25208  *
25209  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
25210  * try:
25211  * _import_umath()
25212  */
25213 
25214  /*--- Wrapped vars code ---*/
25215 
25216  goto __pyx_L0;
25217  __pyx_L1_error:;
25218  __Pyx_XDECREF(__pyx_t_1);
25219  if (__pyx_m) {
25220  if (__pyx_d) {
25221  __Pyx_AddTraceback("init subsurfaceTransportFunctions", 0, __pyx_lineno, __pyx_filename);
25222  }
25223  Py_DECREF(__pyx_m); __pyx_m = 0;
25224  } else if (!PyErr_Occurred()) {
25225  PyErr_SetString(PyExc_ImportError, "init subsurfaceTransportFunctions");
25226  }
25227  __pyx_L0:;
25228  __Pyx_RefNannyFinishContext();
25229  #if CYTHON_PEP489_MULTI_PHASE_INIT
25230  return (__pyx_m != NULL) ? 0 : -1;
25231  #elif PY_MAJOR_VERSION >= 3
25232  return __pyx_m;
25233  #else
25234  return;
25235  #endif
25236 }
25237 
25238 /* --- Runtime support code --- */
25239 /* Refnanny */
25240 #if CYTHON_REFNANNY
25241 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
25242  PyObject *m = NULL, *p = NULL;
25243  void *r = NULL;
25244  m = PyImport_ImportModule((char *)modname);
25245  if (!m) goto end;
25246  p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
25247  if (!p) goto end;
25248  r = PyLong_AsVoidPtr(p);
25249 end:
25250  Py_XDECREF(p);
25251  Py_XDECREF(m);
25252  return (__Pyx_RefNannyAPIStruct *)r;
25253 }
25254 #endif
25255 
25256 /* PyObjectGetAttrStr */
25257 #if CYTHON_USE_TYPE_SLOTS
25258 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
25259  PyTypeObject* tp = Py_TYPE(obj);
25260  if (likely(tp->tp_getattro))
25261  return tp->tp_getattro(obj, attr_name);
25262 #if PY_MAJOR_VERSION < 3
25263  if (likely(tp->tp_getattr))
25264  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
25265 #endif
25266  return PyObject_GetAttr(obj, attr_name);
25267 }
25268 #endif
25269 
25270 /* GetBuiltinName */
25271 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
25272  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
25273  if (unlikely(!result)) {
25274  PyErr_Format(PyExc_NameError,
25275 #if PY_MAJOR_VERSION >= 3
25276  "name '%U' is not defined", name);
25277 #else
25278  "name '%.200s' is not defined", PyString_AS_STRING(name));
25279 #endif
25280  }
25281  return result;
25282 }
25283 
25284 /* RaiseArgTupleInvalid */
25285 static void __Pyx_RaiseArgtupleInvalid(
25286  const char* func_name,
25287  int exact,
25288  Py_ssize_t num_min,
25289  Py_ssize_t num_max,
25290  Py_ssize_t num_found)
25291 {
25292  Py_ssize_t num_expected;
25293  const char *more_or_less;
25294  if (num_found < num_min) {
25295  num_expected = num_min;
25296  more_or_less = "at least";
25297  } else {
25298  num_expected = num_max;
25299  more_or_less = "at most";
25300  }
25301  if (exact) {
25302  more_or_less = "exactly";
25303  }
25304  PyErr_Format(PyExc_TypeError,
25305  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
25306  func_name, more_or_less, num_expected,
25307  (num_expected == 1) ? "" : "s", num_found);
25308 }
25309 
25310 /* RaiseDoubleKeywords */
25311 static void __Pyx_RaiseDoubleKeywordsError(
25312  const char* func_name,
25313  PyObject* kw_name)
25314 {
25315  PyErr_Format(PyExc_TypeError,
25316  #if PY_MAJOR_VERSION >= 3
25317  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
25318  #else
25319  "%s() got multiple values for keyword argument '%s'", func_name,
25320  PyString_AsString(kw_name));
25321  #endif
25322 }
25323 
25324 /* ParseKeywords */
25325 static int __Pyx_ParseOptionalKeywords(
25326  PyObject *kwds,
25327  PyObject **argnames[],
25328  PyObject *kwds2,
25329  PyObject *values[],
25330  Py_ssize_t num_pos_args,
25331  const char* function_name)
25332 {
25333  PyObject *key = 0, *value = 0;
25334  Py_ssize_t pos = 0;
25335  PyObject*** name;
25336  PyObject*** first_kw_arg = argnames + num_pos_args;
25337  while (PyDict_Next(kwds, &pos, &key, &value)) {
25338  name = first_kw_arg;
25339  while (*name && (**name != key)) name++;
25340  if (*name) {
25341  values[name-argnames] = value;
25342  continue;
25343  }
25344  name = first_kw_arg;
25345  #if PY_MAJOR_VERSION < 3
25346  if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
25347  while (*name) {
25348  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
25349  && _PyString_Eq(**name, key)) {
25350  values[name-argnames] = value;
25351  break;
25352  }
25353  name++;
25354  }
25355  if (*name) continue;
25356  else {
25357  PyObject*** argname = argnames;
25358  while (argname != first_kw_arg) {
25359  if ((**argname == key) || (
25360  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
25361  && _PyString_Eq(**argname, key))) {
25362  goto arg_passed_twice;
25363  }
25364  argname++;
25365  }
25366  }
25367  } else
25368  #endif
25369  if (likely(PyUnicode_Check(key))) {
25370  while (*name) {
25371  int cmp = (**name == key) ? 0 :
25372  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
25373  (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
25374  #endif
25375  PyUnicode_Compare(**name, key);
25376  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
25377  if (cmp == 0) {
25378  values[name-argnames] = value;
25379  break;
25380  }
25381  name++;
25382  }
25383  if (*name) continue;
25384  else {
25385  PyObject*** argname = argnames;
25386  while (argname != first_kw_arg) {
25387  int cmp = (**argname == key) ? 0 :
25388  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
25389  (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
25390  #endif
25391  PyUnicode_Compare(**argname, key);
25392  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
25393  if (cmp == 0) goto arg_passed_twice;
25394  argname++;
25395  }
25396  }
25397  } else
25398  goto invalid_keyword_type;
25399  if (kwds2) {
25400  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
25401  } else {
25402  goto invalid_keyword;
25403  }
25404  }
25405  return 0;
25406 arg_passed_twice:
25407  __Pyx_RaiseDoubleKeywordsError(function_name, key);
25408  goto bad;
25409 invalid_keyword_type:
25410  PyErr_Format(PyExc_TypeError,
25411  "%.200s() keywords must be strings", function_name);
25412  goto bad;
25413 invalid_keyword:
25414  PyErr_Format(PyExc_TypeError,
25415  #if PY_MAJOR_VERSION < 3
25416  "%.200s() got an unexpected keyword argument '%.200s'",
25417  function_name, PyString_AsString(key));
25418  #else
25419  "%s() got an unexpected keyword argument '%U'",
25420  function_name, key);
25421  #endif
25422 bad:
25423  return -1;
25424 }
25425 
25426 /* ArgTypeTest */
25427 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
25428 {
25429  if (unlikely(!type)) {
25430  PyErr_SetString(PyExc_SystemError, "Missing type object");
25431  return 0;
25432  }
25433  else if (exact) {
25434  #if PY_MAJOR_VERSION == 2
25435  if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
25436  #endif
25437  }
25438  else {
25439  if (likely(__Pyx_TypeCheck(obj, type))) return 1;
25440  }
25441  PyErr_Format(PyExc_TypeError,
25442  "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
25443  name, type->tp_name, Py_TYPE(obj)->tp_name);
25444  return 0;
25445 }
25446 
25447 /* IsLittleEndian */
25448 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
25449 {
25450  union {
25451  uint32_t u32;
25452  uint8_t u8[4];
25453  } S;
25454  S.u32 = 0x01020304;
25455  return S.u8[0] == 4;
25456 }
25457 
25458 /* BufferFormatCheck */
25459 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
25460  __Pyx_BufFmt_StackElem* stack,
25461  __Pyx_TypeInfo* type) {
25462  stack[0].field = &ctx->root;
25463  stack[0].parent_offset = 0;
25464  ctx->root.type = type;
25465  ctx->root.name = "buffer dtype";
25466  ctx->root.offset = 0;
25467  ctx->head = stack;
25468  ctx->head->field = &ctx->root;
25469  ctx->fmt_offset = 0;
25470  ctx->head->parent_offset = 0;
25471  ctx->new_packmode = '@';
25472  ctx->enc_packmode = '@';
25473  ctx->new_count = 1;
25474  ctx->enc_count = 0;
25475  ctx->enc_type = 0;
25476  ctx->is_complex = 0;
25477  ctx->is_valid_array = 0;
25478  ctx->struct_alignment = 0;
25479  while (type->typegroup == 'S') {
25480  ++ctx->head;
25481  ctx->head->field = type->fields;
25482  ctx->head->parent_offset = 0;
25483  type = type->fields->type;
25484  }
25485 }
25486 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
25487  int count;
25488  const char* t = *ts;
25489  if (*t < '0' || *t > '9') {
25490  return -1;
25491  } else {
25492  count = *t++ - '0';
25493  while (*t >= '0' && *t < '9') {
25494  count *= 10;
25495  count += *t++ - '0';
25496  }
25497  }
25498  *ts = t;
25499  return count;
25500 }
25501 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
25502  int number = __Pyx_BufFmt_ParseNumber(ts);
25503  if (number == -1)
25504  PyErr_Format(PyExc_ValueError,\
25505  "Does not understand character buffer dtype format string ('%c')", **ts);
25506  return number;
25507 }
25508 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
25509  PyErr_Format(PyExc_ValueError,
25510  "Unexpected format string character: '%c'", ch);
25511 }
25512 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
25513  switch (ch) {
25514  case 'c': return "'char'";
25515  case 'b': return "'signed char'";
25516  case 'B': return "'unsigned char'";
25517  case 'h': return "'short'";
25518  case 'H': return "'unsigned short'";
25519  case 'i': return "'int'";
25520  case 'I': return "'unsigned int'";
25521  case 'l': return "'long'";
25522  case 'L': return "'unsigned long'";
25523  case 'q': return "'long long'";
25524  case 'Q': return "'unsigned long long'";
25525  case 'f': return (is_complex ? "'complex float'" : "'float'");
25526  case 'd': return (is_complex ? "'complex double'" : "'double'");
25527  case 'g': return (is_complex ? "'complex long double'" : "'long double'");
25528  case 'T': return "a struct";
25529  case 'O': return "Python object";
25530  case 'P': return "a pointer";
25531  case 's': case 'p': return "a string";
25532  case 0: return "end";
25533  default: return "unparseable format string";
25534  }
25535 }
25536 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
25537  switch (ch) {
25538  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25539  case 'h': case 'H': return 2;
25540  case 'i': case 'I': case 'l': case 'L': return 4;
25541  case 'q': case 'Q': return 8;
25542  case 'f': return (is_complex ? 8 : 4);
25543  case 'd': return (is_complex ? 16 : 8);
25544  case 'g': {
25545  PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
25546  return 0;
25547  }
25548  case 'O': case 'P': return sizeof(void*);
25549  default:
25550  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25551  return 0;
25552  }
25553 }
25554 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
25555  switch (ch) {
25556  case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25557  case 'h': case 'H': return sizeof(short);
25558  case 'i': case 'I': return sizeof(int);
25559  case 'l': case 'L': return sizeof(long);
25560  #ifdef HAVE_LONG_LONG
25561  case 'q': case 'Q': return sizeof(PY_LONG_LONG);
25562  #endif
25563  case 'f': return sizeof(float) * (is_complex ? 2 : 1);
25564  case 'd': return sizeof(double) * (is_complex ? 2 : 1);
25565  case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
25566  case 'O': case 'P': return sizeof(void*);
25567  default: {
25568  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25569  return 0;
25570  }
25571  }
25572 }
25573 typedef struct { char c; short x; } __Pyx_st_short;
25574 typedef struct { char c; int x; } __Pyx_st_int;
25575 typedef struct { char c; long x; } __Pyx_st_long;
25576 typedef struct { char c; float x; } __Pyx_st_float;
25577 typedef struct { char c; double x; } __Pyx_st_double;
25578 typedef struct { char c; long double x; } __Pyx_st_longdouble;
25579 typedef struct { char c; void *x; } __Pyx_st_void_p;
25580 #ifdef HAVE_LONG_LONG
25581 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
25582 #endif
25583 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
25584  switch (ch) {
25585  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25586  case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
25587  case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
25588  case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
25589 #ifdef HAVE_LONG_LONG
25590  case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
25591 #endif
25592  case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
25593  case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
25594  case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
25595  case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
25596  default:
25597  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25598  return 0;
25599  }
25600 }
25601 /* These are for computing the padding at the end of the struct to align
25602  on the first member of the struct. This will probably the same as above,
25603  but we don't have any guarantees.
25604  */
25605 typedef struct { short x; char c; } __Pyx_pad_short;
25606 typedef struct { int x; char c; } __Pyx_pad_int;
25607 typedef struct { long x; char c; } __Pyx_pad_long;
25608 typedef struct { float x; char c; } __Pyx_pad_float;
25609 typedef struct { double x; char c; } __Pyx_pad_double;
25610 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
25611 typedef struct { void *x; char c; } __Pyx_pad_void_p;
25612 #ifdef HAVE_LONG_LONG
25613 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
25614 #endif
25615 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
25616  switch (ch) {
25617  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25618  case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
25619  case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
25620  case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
25621 #ifdef HAVE_LONG_LONG
25622  case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
25623 #endif
25624  case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
25625  case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
25626  case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
25627  case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
25628  default:
25629  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25630  return 0;
25631  }
25632 }
25633 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
25634  switch (ch) {
25635  case 'c':
25636  return 'H';
25637  case 'b': case 'h': case 'i':
25638  case 'l': case 'q': case 's': case 'p':
25639  return 'I';
25640  case 'B': case 'H': case 'I': case 'L': case 'Q':
25641  return 'U';
25642  case 'f': case 'd': case 'g':
25643  return (is_complex ? 'C' : 'R');
25644  case 'O':
25645  return 'O';
25646  case 'P':
25647  return 'P';
25648  default: {
25649  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25650  return 0;
25651  }
25652  }
25653 }
25654 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
25655  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
25656  const char* expected;
25657  const char* quote;
25658  if (ctx->head == NULL) {
25659  expected = "end";
25660  quote = "";
25661  } else {
25662  expected = ctx->head->field->type->name;
25663  quote = "'";
25664  }
25665  PyErr_Format(PyExc_ValueError,
25666  "Buffer dtype mismatch, expected %s%s%s but got %s",
25667  quote, expected, quote,
25668  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
25669  } else {
25670  __Pyx_StructField* field = ctx->head->field;
25671  __Pyx_StructField* parent = (ctx->head - 1)->field;
25672  PyErr_Format(PyExc_ValueError,
25673  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
25674  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
25675  parent->type->name, field->name);
25676  }
25677 }
25678 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
25679  char group;
25680  size_t size, offset, arraysize = 1;
25681  if (ctx->enc_type == 0) return 0;
25682  if (ctx->head->field->type->arraysize[0]) {
25683  int i, ndim = 0;
25684  if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
25685  ctx->is_valid_array = ctx->head->field->type->ndim == 1;
25686  ndim = 1;
25687  if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
25688  PyErr_Format(PyExc_ValueError,
25689  "Expected a dimension of size %zu, got %zu",
25690  ctx->head->field->type->arraysize[0], ctx->enc_count);
25691  return -1;
25692  }
25693  }
25694  if (!ctx->is_valid_array) {
25695  PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
25696  ctx->head->field->type->ndim, ndim);
25697  return -1;
25698  }
25699  for (i = 0; i < ctx->head->field->type->ndim; i++) {
25700  arraysize *= ctx->head->field->type->arraysize[i];
25701  }
25702  ctx->is_valid_array = 0;
25703  ctx->enc_count = 1;
25704  }
25705  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
25706  do {
25707  __Pyx_StructField* field = ctx->head->field;
25708  __Pyx_TypeInfo* type = field->type;
25709  if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
25710  size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
25711  } else {
25712  size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
25713  }
25714  if (ctx->enc_packmode == '@') {
25715  size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
25716  size_t align_mod_offset;
25717  if (align_at == 0) return -1;
25718  align_mod_offset = ctx->fmt_offset % align_at;
25719  if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
25720  if (ctx->struct_alignment == 0)
25721  ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
25722  ctx->is_complex);
25723  }
25724  if (type->size != size || type->typegroup != group) {
25725  if (type->typegroup == 'C' && type->fields != NULL) {
25726  size_t parent_offset = ctx->head->parent_offset + field->offset;
25727  ++ctx->head;
25728  ctx->head->field = type->fields;
25729  ctx->head->parent_offset = parent_offset;
25730  continue;
25731  }
25732  if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
25733  } else {
25734  __Pyx_BufFmt_RaiseExpected(ctx);
25735  return -1;
25736  }
25737  }
25738  offset = ctx->head->parent_offset + field->offset;
25739  if (ctx->fmt_offset != offset) {
25740  PyErr_Format(PyExc_ValueError,
25741  "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
25742  (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
25743  return -1;
25744  }
25745  ctx->fmt_offset += size;
25746  if (arraysize)
25747  ctx->fmt_offset += (arraysize - 1) * size;
25748  --ctx->enc_count;
25749  while (1) {
25750  if (field == &ctx->root) {
25751  ctx->head = NULL;
25752  if (ctx->enc_count != 0) {
25753  __Pyx_BufFmt_RaiseExpected(ctx);
25754  return -1;
25755  }
25756  break;
25757  }
25758  ctx->head->field = ++field;
25759  if (field->type == NULL) {
25760  --ctx->head;
25761  field = ctx->head->field;
25762  continue;
25763  } else if (field->type->typegroup == 'S') {
25764  size_t parent_offset = ctx->head->parent_offset + field->offset;
25765  if (field->type->fields->type == NULL) continue;
25766  field = field->type->fields;
25767  ++ctx->head;
25768  ctx->head->field = field;
25769  ctx->head->parent_offset = parent_offset;
25770  break;
25771  } else {
25772  break;
25773  }
25774  }
25775  } while (ctx->enc_count);
25776  ctx->enc_type = 0;
25777  ctx->is_complex = 0;
25778  return 0;
25779 }
25780 static PyObject *
25781 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
25782 {
25783  const char *ts = *tsp;
25784  int i = 0, number;
25785  int ndim = ctx->head->field->type->ndim;
25786 ;
25787  ++ts;
25788  if (ctx->new_count != 1) {
25789  PyErr_SetString(PyExc_ValueError,
25790  "Cannot handle repeated arrays in format string");
25791  return NULL;
25792  }
25793  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25794  while (*ts && *ts != ')') {
25795  switch (*ts) {
25796  case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
25797  default: break;
25798  }
25799  number = __Pyx_BufFmt_ExpectNumber(&ts);
25800  if (number == -1) return NULL;
25801  if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
25802  return PyErr_Format(PyExc_ValueError,
25803  "Expected a dimension of size %zu, got %d",
25804  ctx->head->field->type->arraysize[i], number);
25805  if (*ts != ',' && *ts != ')')
25806  return PyErr_Format(PyExc_ValueError,
25807  "Expected a comma in format string, got '%c'", *ts);
25808  if (*ts == ',') ts++;
25809  i++;
25810  }
25811  if (i != ndim)
25812  return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
25813  ctx->head->field->type->ndim, i);
25814  if (!*ts) {
25815  PyErr_SetString(PyExc_ValueError,
25816  "Unexpected end of format string, expected ')'");
25817  return NULL;
25818  }
25819  ctx->is_valid_array = 1;
25820  ctx->new_count = 1;
25821  *tsp = ++ts;
25822  return Py_None;
25823 }
25824 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
25825  int got_Z = 0;
25826  while (1) {
25827  switch(*ts) {
25828  case 0:
25829  if (ctx->enc_type != 0 && ctx->head == NULL) {
25830  __Pyx_BufFmt_RaiseExpected(ctx);
25831  return NULL;
25832  }
25833  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25834  if (ctx->head != NULL) {
25835  __Pyx_BufFmt_RaiseExpected(ctx);
25836  return NULL;
25837  }
25838  return ts;
25839  case ' ':
25840  case '\r':
25841  case '\n':
25842  ++ts;
25843  break;
25844  case '<':
25845  if (!__Pyx_Is_Little_Endian()) {
25846  PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
25847  return NULL;
25848  }
25849  ctx->new_packmode = '=';
25850  ++ts;
25851  break;
25852  case '>':
25853  case '!':
25854  if (__Pyx_Is_Little_Endian()) {
25855  PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
25856  return NULL;
25857  }
25858  ctx->new_packmode = '=';
25859  ++ts;
25860  break;
25861  case '=':
25862  case '@':
25863  case '^':
25864  ctx->new_packmode = *ts++;
25865  break;
25866  case 'T':
25867  {
25868  const char* ts_after_sub;
25869  size_t i, struct_count = ctx->new_count;
25870  size_t struct_alignment = ctx->struct_alignment;
25871  ctx->new_count = 1;
25872  ++ts;
25873  if (*ts != '{') {
25874  PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
25875  return NULL;
25876  }
25877  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25878  ctx->enc_type = 0;
25879  ctx->enc_count = 0;
25880  ctx->struct_alignment = 0;
25881  ++ts;
25882  ts_after_sub = ts;
25883  for (i = 0; i != struct_count; ++i) {
25884  ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
25885  if (!ts_after_sub) return NULL;
25886  }
25887  ts = ts_after_sub;
25888  if (struct_alignment) ctx->struct_alignment = struct_alignment;
25889  }
25890  break;
25891  case '}':
25892  {
25893  size_t alignment = ctx->struct_alignment;
25894  ++ts;
25895  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25896  ctx->enc_type = 0;
25897  if (alignment && ctx->fmt_offset % alignment) {
25898  ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
25899  }
25900  }
25901  return ts;
25902  case 'x':
25903  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25904  ctx->fmt_offset += ctx->new_count;
25905  ctx->new_count = 1;
25906  ctx->enc_count = 0;
25907  ctx->enc_type = 0;
25908  ctx->enc_packmode = ctx->new_packmode;
25909  ++ts;
25910  break;
25911  case 'Z':
25912  got_Z = 1;
25913  ++ts;
25914  if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
25915  __Pyx_BufFmt_RaiseUnexpectedChar('Z');
25916  return NULL;
25917  }
25918  CYTHON_FALLTHROUGH;
25919  case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
25920  case 'l': case 'L': case 'q': case 'Q':
25921  case 'f': case 'd': case 'g':
25922  case 'O': case 'p':
25923  if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
25924  ctx->enc_packmode == ctx->new_packmode) {
25925  ctx->enc_count += ctx->new_count;
25926  ctx->new_count = 1;
25927  got_Z = 0;
25928  ++ts;
25929  break;
25930  }
25931  CYTHON_FALLTHROUGH;
25932  case 's':
25933  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25934  ctx->enc_count = ctx->new_count;
25935  ctx->enc_packmode = ctx->new_packmode;
25936  ctx->enc_type = *ts;
25937  ctx->is_complex = got_Z;
25938  ++ts;
25939  ctx->new_count = 1;
25940  got_Z = 0;
25941  break;
25942  case ':':
25943  ++ts;
25944  while(*ts != ':') ++ts;
25945  ++ts;
25946  break;
25947  case '(':
25948  if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
25949  break;
25950  default:
25951  {
25952  int number = __Pyx_BufFmt_ExpectNumber(&ts);
25953  if (number == -1) return NULL;
25954  ctx->new_count = (size_t)number;
25955  }
25956  }
25957  }
25958 }
25959 
25960 /* BufferGetAndValidate */
25961  static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
25962  if (unlikely(info->buf == NULL)) return;
25963  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
25964  __Pyx_ReleaseBuffer(info);
25965 }
25966 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
25967  buf->buf = NULL;
25968  buf->obj = NULL;
25969  buf->strides = __Pyx_zeros;
25970  buf->shape = __Pyx_zeros;
25971  buf->suboffsets = __Pyx_minusones;
25972 }
25973 static int __Pyx__GetBufferAndValidate(
25974  Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
25975  int nd, int cast, __Pyx_BufFmt_StackElem* stack)
25976 {
25977  buf->buf = NULL;
25978  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
25979  __Pyx_ZeroBuffer(buf);
25980  return -1;
25981  }
25982  if (unlikely(buf->ndim != nd)) {
25983  PyErr_Format(PyExc_ValueError,
25984  "Buffer has wrong number of dimensions (expected %d, got %d)",
25985  nd, buf->ndim);
25986  goto fail;
25987  }
25988  if (!cast) {
25989  __Pyx_BufFmt_Context ctx;
25990  __Pyx_BufFmt_Init(&ctx, stack, dtype);
25991  if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
25992  }
25993  if (unlikely((unsigned)buf->itemsize != dtype->size)) {
25994  PyErr_Format(PyExc_ValueError,
25995  "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
25996  buf->itemsize, (buf->itemsize > 1) ? "s" : "",
25997  dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
25998  goto fail;
25999  }
26000  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
26001  return 0;
26002 fail:;
26003  __Pyx_SafeReleaseBuffer(buf);
26004  return -1;
26005 }
26006 
26007 /* BufferIndexError */
26008  static void __Pyx_RaiseBufferIndexError(int axis) {
26009  PyErr_Format(PyExc_IndexError,
26010  "Out of bounds on buffer access (axis %d)", axis);
26011 }
26012 
26013 /* PyErrFetchRestore */
26014  #if CYTHON_FAST_THREAD_STATE
26015 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
26016  PyObject *tmp_type, *tmp_value, *tmp_tb;
26017  tmp_type = tstate->curexc_type;
26018  tmp_value = tstate->curexc_value;
26019  tmp_tb = tstate->curexc_traceback;
26020  tstate->curexc_type = type;
26021  tstate->curexc_value = value;
26022  tstate->curexc_traceback = tb;
26023  Py_XDECREF(tmp_type);
26024  Py_XDECREF(tmp_value);
26025  Py_XDECREF(tmp_tb);
26026 }
26027 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
26028  *type = tstate->curexc_type;
26029  *value = tstate->curexc_value;
26030  *tb = tstate->curexc_traceback;
26031  tstate->curexc_type = 0;
26032  tstate->curexc_value = 0;
26033  tstate->curexc_traceback = 0;
26034 }
26035 #endif
26036 
26037 /* DictGetItem */
26038  #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
26039 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
26040  PyObject *value;
26041  value = PyDict_GetItemWithError(d, key);
26042  if (unlikely(!value)) {
26043  if (!PyErr_Occurred()) {
26044  PyObject* args = PyTuple_Pack(1, key);
26045  if (likely(args))
26046  PyErr_SetObject(PyExc_KeyError, args);
26047  Py_XDECREF(args);
26048  }
26049  return NULL;
26050  }
26051  Py_INCREF(value);
26052  return value;
26053 }
26054 #endif
26055 
26056 /* GetItemInt */
26057  static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
26058  PyObject *r;
26059  if (!j) return NULL;
26060  r = PyObject_GetItem(o, j);
26061  Py_DECREF(j);
26062  return r;
26063 }
26064 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
26065  CYTHON_NCP_UNUSED int wraparound,
26066  CYTHON_NCP_UNUSED int boundscheck) {
26067 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
26068  Py_ssize_t wrapped_i = i;
26069  if (wraparound & unlikely(i < 0)) {
26070  wrapped_i += PyList_GET_SIZE(o);
26071  }
26072  if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) {
26073  PyObject *r = PyList_GET_ITEM(o, wrapped_i);
26074  Py_INCREF(r);
26075  return r;
26076  }
26077  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
26078 #else
26079  return PySequence_GetItem(o, i);
26080 #endif
26081 }
26082 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
26083  CYTHON_NCP_UNUSED int wraparound,
26084  CYTHON_NCP_UNUSED int boundscheck) {
26085 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
26086  Py_ssize_t wrapped_i = i;
26087  if (wraparound & unlikely(i < 0)) {
26088  wrapped_i += PyTuple_GET_SIZE(o);
26089  }
26090  if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) {
26091  PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
26092  Py_INCREF(r);
26093  return r;
26094  }
26095  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
26096 #else
26097  return PySequence_GetItem(o, i);
26098 #endif
26099 }
26100 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
26101  CYTHON_NCP_UNUSED int wraparound,
26102  CYTHON_NCP_UNUSED int boundscheck) {
26103 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
26104  if (is_list || PyList_CheckExact(o)) {
26105  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
26106  if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
26107  PyObject *r = PyList_GET_ITEM(o, n);
26108  Py_INCREF(r);
26109  return r;
26110  }
26111  }
26112  else if (PyTuple_CheckExact(o)) {
26113  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
26114  if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
26115  PyObject *r = PyTuple_GET_ITEM(o, n);
26116  Py_INCREF(r);
26117  return r;
26118  }
26119  } else {
26120  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
26121  if (likely(m && m->sq_item)) {
26122  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
26123  Py_ssize_t l = m->sq_length(o);
26124  if (likely(l >= 0)) {
26125  i += l;
26126  } else {
26127  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
26128  return NULL;
26129  PyErr_Clear();
26130  }
26131  }
26132  return m->sq_item(o, i);
26133  }
26134  }
26135 #else
26136  if (is_list || PySequence_Check(o)) {
26137  return PySequence_GetItem(o, i);
26138  }
26139 #endif
26140  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
26141 }
26142 
26143 /* ObjectGetItem */
26144  #if CYTHON_USE_TYPE_SLOTS
26145 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
26146  PyObject *runerr;
26147  Py_ssize_t key_value;
26148  PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
26149  if (unlikely(!(m && m->sq_item))) {
26150  PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
26151  return NULL;
26152  }
26153  key_value = __Pyx_PyIndex_AsSsize_t(index);
26154  if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
26155  return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
26156  }
26157  if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
26158  PyErr_Clear();
26159  PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
26160  }
26161  return NULL;
26162 }
26163 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
26164  PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
26165  if (likely(m && m->mp_subscript)) {
26166  return m->mp_subscript(obj, key);
26167  }
26168  return __Pyx_PyObject_GetIndex(obj, key);
26169 }
26170 #endif
26171 
26172 /* PyFloatBinop */
26173  #if !CYTHON_COMPILING_IN_PYPY
26174 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
26175  const double b = floatval;
26176  double a, result;
26177  if (likely(PyFloat_CheckExact(op1))) {
26178  a = PyFloat_AS_DOUBLE(op1);
26179  } else
26180  #if PY_MAJOR_VERSION < 3
26181  if (likely(PyInt_CheckExact(op1))) {
26182  a = (double) PyInt_AS_LONG(op1);
26183  } else
26184  #endif
26185  if (likely(PyLong_CheckExact(op1))) {
26186  #if CYTHON_USE_PYLONG_INTERNALS
26187  const digit* digits = ((PyLongObject*)op1)->ob_digit;
26188  const Py_ssize_t size = Py_SIZE(op1);
26189  switch (size) {
26190  case 0: a = 0.0; break;
26191  case -1: a = -(double) digits[0]; break;
26192  case 1: a = (double) digits[0]; break;
26193  case -2:
26194  case 2:
26195  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
26196  a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26197  if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
26198  if (size == -2)
26199  a = -a;
26200  break;
26201  }
26202  }
26203  CYTHON_FALLTHROUGH;
26204  case -3:
26205  case 3:
26206  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
26207  a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26208  if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
26209  if (size == -3)
26210  a = -a;
26211  break;
26212  }
26213  }
26214  CYTHON_FALLTHROUGH;
26215  case -4:
26216  case 4:
26217  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
26218  a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26219  if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
26220  if (size == -4)
26221  a = -a;
26222  break;
26223  }
26224  }
26225  CYTHON_FALLTHROUGH;
26226  default:
26227  #else
26228  {
26229  #endif
26230  a = PyLong_AsDouble(op1);
26231  if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
26232  }
26233  } else {
26234  return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
26235  }
26236  PyFPE_START_PROTECT("add", return NULL)
26237  result = a + b;
26238  PyFPE_END_PROTECT(result)
26239  return PyFloat_FromDouble(result);
26240 }
26241 #endif
26242 
26243 /* PyFunctionFastCall */
26244  #if CYTHON_FAST_PYCALL
26245 #include "frameobject.h"
26246 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
26247  PyObject *globals) {
26248  PyFrameObject *f;
26249  PyThreadState *tstate = __Pyx_PyThreadState_Current;
26250  PyObject **fastlocals;
26251  Py_ssize_t i;
26252  PyObject *result;
26253  assert(globals != NULL);
26254  /* XXX Perhaps we should create a specialized
26255  PyFrame_New() that doesn't take locals, but does
26256  take builtins without sanity checking them.
26257  */
26258  assert(tstate != NULL);
26259  f = PyFrame_New(tstate, co, globals, NULL);
26260  if (f == NULL) {
26261  return NULL;
26262  }
26263  fastlocals = f->f_localsplus;
26264  for (i = 0; i < na; i++) {
26265  Py_INCREF(*args);
26266  fastlocals[i] = *args++;
26267  }
26268  result = PyEval_EvalFrameEx(f,0);
26269  ++tstate->recursion_depth;
26270  Py_DECREF(f);
26271  --tstate->recursion_depth;
26272  return result;
26273 }
26274 #if 1 || PY_VERSION_HEX < 0x030600B1
26275 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
26276  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
26277  PyObject *globals = PyFunction_GET_GLOBALS(func);
26278  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
26279  PyObject *closure;
26280 #if PY_MAJOR_VERSION >= 3
26281  PyObject *kwdefs;
26282 #endif
26283  PyObject *kwtuple, **k;
26284  PyObject **d;
26285  Py_ssize_t nd;
26286  Py_ssize_t nk;
26287  PyObject *result;
26288  assert(kwargs == NULL || PyDict_Check(kwargs));
26289  nk = kwargs ? PyDict_Size(kwargs) : 0;
26290  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
26291  return NULL;
26292  }
26293  if (
26294 #if PY_MAJOR_VERSION >= 3
26295  co->co_kwonlyargcount == 0 &&
26296 #endif
26297  likely(kwargs == NULL || nk == 0) &&
26298  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
26299  if (argdefs == NULL && co->co_argcount == nargs) {
26300  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
26301  goto done;
26302  }
26303  else if (nargs == 0 && argdefs != NULL
26304  && co->co_argcount == Py_SIZE(argdefs)) {
26305  /* function called with no arguments, but all parameters have
26306  a default value: use default values as arguments .*/
26307  args = &PyTuple_GET_ITEM(argdefs, 0);
26308  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
26309  goto done;
26310  }
26311  }
26312  if (kwargs != NULL) {
26313  Py_ssize_t pos, i;
26314  kwtuple = PyTuple_New(2 * nk);
26315  if (kwtuple == NULL) {
26316  result = NULL;
26317  goto done;
26318  }
26319  k = &PyTuple_GET_ITEM(kwtuple, 0);
26320  pos = i = 0;
26321  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
26322  Py_INCREF(k[i]);
26323  Py_INCREF(k[i+1]);
26324  i += 2;
26325  }
26326  nk = i / 2;
26327  }
26328  else {
26329  kwtuple = NULL;
26330  k = NULL;
26331  }
26332  closure = PyFunction_GET_CLOSURE(func);
26333 #if PY_MAJOR_VERSION >= 3
26334  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
26335 #endif
26336  if (argdefs != NULL) {
26337  d = &PyTuple_GET_ITEM(argdefs, 0);
26338  nd = Py_SIZE(argdefs);
26339  }
26340  else {
26341  d = NULL;
26342  nd = 0;
26343  }
26344 #if PY_MAJOR_VERSION >= 3
26345  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
26346  args, nargs,
26347  k, (int)nk,
26348  d, (int)nd, kwdefs, closure);
26349 #else
26350  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
26351  args, nargs,
26352  k, (int)nk,
26353  d, (int)nd, closure);
26354 #endif
26355  Py_XDECREF(kwtuple);
26356 done:
26357  Py_LeaveRecursiveCall();
26358  return result;
26359 }
26360 #endif
26361 #endif
26362 
26363 /* PyCFunctionFastCall */
26364  #if CYTHON_FAST_PYCCALL
26365 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
26366  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
26367  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
26368  PyObject *self = PyCFunction_GET_SELF(func);
26369  int flags = PyCFunction_GET_FLAGS(func);
26370  assert(PyCFunction_Check(func));
26371  assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
26372  assert(nargs >= 0);
26373  assert(nargs == 0 || args != NULL);
26374  /* _PyCFunction_FastCallDict() must not be called with an exception set,
26375  because it may clear it (directly or indirectly) and so the
26376  caller loses its exception */
26377  assert(!PyErr_Occurred());
26378  if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
26379  return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL);
26380  } else {
26381  return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs);
26382  }
26383 }
26384 #endif
26385 
26386 /* PyObjectCall */
26387  #if CYTHON_COMPILING_IN_CPYTHON
26388 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
26389  PyObject *result;
26390  ternaryfunc call = func->ob_type->tp_call;
26391  if (unlikely(!call))
26392  return PyObject_Call(func, arg, kw);
26393  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
26394  return NULL;
26395  result = (*call)(func, arg, kw);
26396  Py_LeaveRecursiveCall();
26397  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
26398  PyErr_SetString(
26399  PyExc_SystemError,
26400  "NULL result without error in PyObject_Call");
26401  }
26402  return result;
26403 }
26404 #endif
26405 
26406 /* GetModuleGlobalName */
26407  static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
26408  PyObject *result;
26409 #if !CYTHON_AVOID_BORROWED_REFS
26410 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
26411  result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
26412  if (likely(result)) {
26413  Py_INCREF(result);
26414  } else if (unlikely(PyErr_Occurred())) {
26415  result = NULL;
26416  } else {
26417 #else
26418  result = PyDict_GetItem(__pyx_d, name);
26419  if (likely(result)) {
26420  Py_INCREF(result);
26421  } else {
26422 #endif
26423 #else
26424  result = PyObject_GetItem(__pyx_d, name);
26425  if (!result) {
26426  PyErr_Clear();
26427 #endif
26428  result = __Pyx_GetBuiltinName(name);
26429  }
26430  return result;
26431 }
26432 
26433 /* ExtTypeTest */
26434  static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
26435  if (unlikely(!type)) {
26436  PyErr_SetString(PyExc_SystemError, "Missing type object");
26437  return 0;
26438  }
26439  if (likely(__Pyx_TypeCheck(obj, type)))
26440  return 1;
26441  PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
26442  Py_TYPE(obj)->tp_name, type->tp_name);
26443  return 0;
26444 }
26445 
26446 /* PyObjectCallMethO */
26447  #if CYTHON_COMPILING_IN_CPYTHON
26448 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
26449  PyObject *self, *result;
26450  PyCFunction cfunc;
26451  cfunc = PyCFunction_GET_FUNCTION(func);
26452  self = PyCFunction_GET_SELF(func);
26453  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
26454  return NULL;
26455  result = cfunc(self, arg);
26456  Py_LeaveRecursiveCall();
26457  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
26458  PyErr_SetString(
26459  PyExc_SystemError,
26460  "NULL result without error in PyObject_Call");
26461  }
26462  return result;
26463 }
26464 #endif
26465 
26466 /* PyObjectCallOneArg */
26467  #if CYTHON_COMPILING_IN_CPYTHON
26468 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
26469  PyObject *result;
26470  PyObject *args = PyTuple_New(1);
26471  if (unlikely(!args)) return NULL;
26472  Py_INCREF(arg);
26473  PyTuple_SET_ITEM(args, 0, arg);
26474  result = __Pyx_PyObject_Call(func, args, NULL);
26475  Py_DECREF(args);
26476  return result;
26477 }
26478 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
26479 #if CYTHON_FAST_PYCALL
26480  if (PyFunction_Check(func)) {
26481  return __Pyx_PyFunction_FastCall(func, &arg, 1);
26482  }
26483 #endif
26484  if (likely(PyCFunction_Check(func))) {
26485  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
26486  return __Pyx_PyObject_CallMethO(func, arg);
26487 #if CYTHON_FAST_PYCCALL
26488  } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
26489  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
26490 #endif
26491  }
26492  }
26493  return __Pyx__PyObject_CallOneArg(func, arg);
26494 }
26495 #else
26496 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
26497  PyObject *result;
26498  PyObject *args = PyTuple_Pack(1, arg);
26499  if (unlikely(!args)) return NULL;
26500  result = __Pyx_PyObject_Call(func, args, NULL);
26501  Py_DECREF(args);
26502  return result;
26503 }
26504 #endif
26505 
26506 /* pyobject_as_double */
26507  static double __Pyx__PyObject_AsDouble(PyObject* obj) {
26508  PyObject* float_value;
26509 #if !CYTHON_USE_TYPE_SLOTS
26510  float_value = PyNumber_Float(obj); if (0) goto bad;
26511 #else
26512  PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
26513  if (likely(nb) && likely(nb->nb_float)) {
26514  float_value = nb->nb_float(obj);
26515  if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
26516  PyErr_Format(PyExc_TypeError,
26517  "__float__ returned non-float (type %.200s)",
26518  Py_TYPE(float_value)->tp_name);
26519  Py_DECREF(float_value);
26520  goto bad;
26521  }
26522  } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
26523 #if PY_MAJOR_VERSION >= 3
26524  float_value = PyFloat_FromString(obj);
26525 #else
26526  float_value = PyFloat_FromString(obj, 0);
26527 #endif
26528  } else {
26529  PyObject* args = PyTuple_New(1);
26530  if (unlikely(!args)) goto bad;
26531  PyTuple_SET_ITEM(args, 0, obj);
26532  float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
26533  PyTuple_SET_ITEM(args, 0, 0);
26534  Py_DECREF(args);
26535  }
26536 #endif
26537  if (likely(float_value)) {
26538  double value = PyFloat_AS_DOUBLE(float_value);
26539  Py_DECREF(float_value);
26540  return value;
26541  }
26542 bad:
26543  return (double)-1;
26544 }
26545 
26546 /* RaiseException */
26547  #if PY_MAJOR_VERSION < 3
26548 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
26549  CYTHON_UNUSED PyObject *cause) {
26550  __Pyx_PyThreadState_declare
26551  Py_XINCREF(type);
26552  if (!value || value == Py_None)
26553  value = NULL;
26554  else
26555  Py_INCREF(value);
26556  if (!tb || tb == Py_None)
26557  tb = NULL;
26558  else {
26559  Py_INCREF(tb);
26560  if (!PyTraceBack_Check(tb)) {
26561  PyErr_SetString(PyExc_TypeError,
26562  "raise: arg 3 must be a traceback or None");
26563  goto raise_error;
26564  }
26565  }
26566  if (PyType_Check(type)) {
26567 #if CYTHON_COMPILING_IN_PYPY
26568  if (!value) {
26569  Py_INCREF(Py_None);
26570  value = Py_None;
26571  }
26572 #endif
26573  PyErr_NormalizeException(&type, &value, &tb);
26574  } else {
26575  if (value) {
26576  PyErr_SetString(PyExc_TypeError,
26577  "instance exception may not have a separate value");
26578  goto raise_error;
26579  }
26580  value = type;
26581  type = (PyObject*) Py_TYPE(type);
26582  Py_INCREF(type);
26583  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
26584  PyErr_SetString(PyExc_TypeError,
26585  "raise: exception class must be a subclass of BaseException");
26586  goto raise_error;
26587  }
26588  }
26589  __Pyx_PyThreadState_assign
26590  __Pyx_ErrRestore(type, value, tb);
26591  return;
26592 raise_error:
26593  Py_XDECREF(value);
26594  Py_XDECREF(type);
26595  Py_XDECREF(tb);
26596  return;
26597 }
26598 #else
26599 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
26600  PyObject* owned_instance = NULL;
26601  if (tb == Py_None) {
26602  tb = 0;
26603  } else if (tb && !PyTraceBack_Check(tb)) {
26604  PyErr_SetString(PyExc_TypeError,
26605  "raise: arg 3 must be a traceback or None");
26606  goto bad;
26607  }
26608  if (value == Py_None)
26609  value = 0;
26610  if (PyExceptionInstance_Check(type)) {
26611  if (value) {
26612  PyErr_SetString(PyExc_TypeError,
26613  "instance exception may not have a separate value");
26614  goto bad;
26615  }
26616  value = type;
26617  type = (PyObject*) Py_TYPE(value);
26618  } else if (PyExceptionClass_Check(type)) {
26619  PyObject *instance_class = NULL;
26620  if (value && PyExceptionInstance_Check(value)) {
26621  instance_class = (PyObject*) Py_TYPE(value);
26622  if (instance_class != type) {
26623  int is_subclass = PyObject_IsSubclass(instance_class, type);
26624  if (!is_subclass) {
26625  instance_class = NULL;
26626  } else if (unlikely(is_subclass == -1)) {
26627  goto bad;
26628  } else {
26629  type = instance_class;
26630  }
26631  }
26632  }
26633  if (!instance_class) {
26634  PyObject *args;
26635  if (!value)
26636  args = PyTuple_New(0);
26637  else if (PyTuple_Check(value)) {
26638  Py_INCREF(value);
26639  args = value;
26640  } else
26641  args = PyTuple_Pack(1, value);
26642  if (!args)
26643  goto bad;
26644  owned_instance = PyObject_Call(type, args, NULL);
26645  Py_DECREF(args);
26646  if (!owned_instance)
26647  goto bad;
26648  value = owned_instance;
26649  if (!PyExceptionInstance_Check(value)) {
26650  PyErr_Format(PyExc_TypeError,
26651  "calling %R should have returned an instance of "
26652  "BaseException, not %R",
26653  type, Py_TYPE(value));
26654  goto bad;
26655  }
26656  }
26657  } else {
26658  PyErr_SetString(PyExc_TypeError,
26659  "raise: exception class must be a subclass of BaseException");
26660  goto bad;
26661  }
26662  if (cause) {
26663  PyObject *fixed_cause;
26664  if (cause == Py_None) {
26665  fixed_cause = NULL;
26666  } else if (PyExceptionClass_Check(cause)) {
26667  fixed_cause = PyObject_CallObject(cause, NULL);
26668  if (fixed_cause == NULL)
26669  goto bad;
26670  } else if (PyExceptionInstance_Check(cause)) {
26671  fixed_cause = cause;
26672  Py_INCREF(fixed_cause);
26673  } else {
26674  PyErr_SetString(PyExc_TypeError,
26675  "exception causes must derive from "
26676  "BaseException");
26677  goto bad;
26678  }
26679  PyException_SetCause(value, fixed_cause);
26680  }
26681  PyErr_SetObject(type, value);
26682  if (tb) {
26683 #if CYTHON_COMPILING_IN_PYPY
26684  PyObject *tmp_type, *tmp_value, *tmp_tb;
26685  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
26686  Py_INCREF(tb);
26687  PyErr_Restore(tmp_type, tmp_value, tb);
26688  Py_XDECREF(tmp_tb);
26689 #else
26690  PyThreadState *tstate = __Pyx_PyThreadState_Current;
26691  PyObject* tmp_tb = tstate->curexc_traceback;
26692  if (tb != tmp_tb) {
26693  Py_INCREF(tb);
26694  tstate->curexc_traceback = tb;
26695  Py_XDECREF(tmp_tb);
26696  }
26697 #endif
26698  }
26699 bad:
26700  Py_XDECREF(owned_instance);
26701  return;
26702 }
26703 #endif
26704 
26705 /* RaiseTooManyValuesToUnpack */
26706  static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
26707  PyErr_Format(PyExc_ValueError,
26708  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
26709 }
26710 
26711 /* RaiseNeedMoreValuesToUnpack */
26712  static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
26713  PyErr_Format(PyExc_ValueError,
26714  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
26715  index, (index == 1) ? "" : "s");
26716 }
26717 
26718 /* RaiseNoneIterError */
26719  static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
26720  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
26721 }
26722 
26723 /* SaveResetException */
26724  #if CYTHON_FAST_THREAD_STATE
26725 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
26726  #if PY_VERSION_HEX >= 0x030700A3
26727  *type = tstate->exc_state.exc_type;
26728  *value = tstate->exc_state.exc_value;
26729  *tb = tstate->exc_state.exc_traceback;
26730  #else
26731  *type = tstate->exc_type;
26732  *value = tstate->exc_value;
26733  *tb = tstate->exc_traceback;
26734  #endif
26735  Py_XINCREF(*type);
26736  Py_XINCREF(*value);
26737  Py_XINCREF(*tb);
26738 }
26739 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
26740  PyObject *tmp_type, *tmp_value, *tmp_tb;
26741  #if PY_VERSION_HEX >= 0x030700A3
26742  tmp_type = tstate->exc_state.exc_type;
26743  tmp_value = tstate->exc_state.exc_value;
26744  tmp_tb = tstate->exc_state.exc_traceback;
26745  tstate->exc_state.exc_type = type;
26746  tstate->exc_state.exc_value = value;
26747  tstate->exc_state.exc_traceback = tb;
26748  #else
26749  tmp_type = tstate->exc_type;
26750  tmp_value = tstate->exc_value;
26751  tmp_tb = tstate->exc_traceback;
26752  tstate->exc_type = type;
26753  tstate->exc_value = value;
26754  tstate->exc_traceback = tb;
26755  #endif
26756  Py_XDECREF(tmp_type);
26757  Py_XDECREF(tmp_value);
26758  Py_XDECREF(tmp_tb);
26759 }
26760 #endif
26761 
26762 /* PyErrExceptionMatches */
26763  #if CYTHON_FAST_THREAD_STATE
26764 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
26765  Py_ssize_t i, n;
26766  n = PyTuple_GET_SIZE(tuple);
26767 #if PY_MAJOR_VERSION >= 3
26768  for (i=0; i<n; i++) {
26769  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
26770  }
26771 #endif
26772  for (i=0; i<n; i++) {
26773  if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
26774  }
26775  return 0;
26776 }
26777 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
26778  PyObject *exc_type = tstate->curexc_type;
26779  if (exc_type == err) return 1;
26780  if (unlikely(!exc_type)) return 0;
26781  if (unlikely(PyTuple_Check(err)))
26782  return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
26783  return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
26784 }
26785 #endif
26786 
26787 /* GetException */
26788  #if CYTHON_FAST_THREAD_STATE
26789 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
26790 #else
26791 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
26792 #endif
26793  PyObject *local_type, *local_value, *local_tb;
26794 #if CYTHON_FAST_THREAD_STATE
26795  PyObject *tmp_type, *tmp_value, *tmp_tb;
26796  local_type = tstate->curexc_type;
26797  local_value = tstate->curexc_value;
26798  local_tb = tstate->curexc_traceback;
26799  tstate->curexc_type = 0;
26800  tstate->curexc_value = 0;
26801  tstate->curexc_traceback = 0;
26802 #else
26803  PyErr_Fetch(&local_type, &local_value, &local_tb);
26804 #endif
26805  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
26806 #if CYTHON_FAST_THREAD_STATE
26807  if (unlikely(tstate->curexc_type))
26808 #else
26809  if (unlikely(PyErr_Occurred()))
26810 #endif
26811  goto bad;
26812  #if PY_MAJOR_VERSION >= 3
26813  if (local_tb) {
26814  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
26815  goto bad;
26816  }
26817  #endif
26818  Py_XINCREF(local_tb);
26819  Py_XINCREF(local_type);
26820  Py_XINCREF(local_value);
26821  *type = local_type;
26822  *value = local_value;
26823  *tb = local_tb;
26824 #if CYTHON_FAST_THREAD_STATE
26825  #if PY_VERSION_HEX >= 0x030700A3
26826  tmp_type = tstate->exc_state.exc_type;
26827  tmp_value = tstate->exc_state.exc_value;
26828  tmp_tb = tstate->exc_state.exc_traceback;
26829  tstate->exc_state.exc_type = local_type;
26830  tstate->exc_state.exc_value = local_value;
26831  tstate->exc_state.exc_traceback = local_tb;
26832  #else
26833  tmp_type = tstate->exc_type;
26834  tmp_value = tstate->exc_value;
26835  tmp_tb = tstate->exc_traceback;
26836  tstate->exc_type = local_type;
26837  tstate->exc_value = local_value;
26838  tstate->exc_traceback = local_tb;
26839  #endif
26840  Py_XDECREF(tmp_type);
26841  Py_XDECREF(tmp_value);
26842  Py_XDECREF(tmp_tb);
26843 #else
26844  PyErr_SetExcInfo(local_type, local_value, local_tb);
26845 #endif
26846  return 0;
26847 bad:
26848  *type = 0;
26849  *value = 0;
26850  *tb = 0;
26851  Py_XDECREF(local_type);
26852  Py_XDECREF(local_value);
26853  Py_XDECREF(local_tb);
26854  return -1;
26855 }
26856 
26857 /* Import */
26858  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
26859  PyObject *empty_list = 0;
26860  PyObject *module = 0;
26861  PyObject *global_dict = 0;
26862  PyObject *empty_dict = 0;
26863  PyObject *list;
26864  #if PY_MAJOR_VERSION < 3
26865  PyObject *py_import;
26866  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
26867  if (!py_import)
26868  goto bad;
26869  #endif
26870  if (from_list)
26871  list = from_list;
26872  else {
26873  empty_list = PyList_New(0);
26874  if (!empty_list)
26875  goto bad;
26876  list = empty_list;
26877  }
26878  global_dict = PyModule_GetDict(__pyx_m);
26879  if (!global_dict)
26880  goto bad;
26881  empty_dict = PyDict_New();
26882  if (!empty_dict)
26883  goto bad;
26884  {
26885  #if PY_MAJOR_VERSION >= 3
26886  if (level == -1) {
26887  if (strchr(__Pyx_MODULE_NAME, '.')) {
26888  module = PyImport_ImportModuleLevelObject(
26889  name, global_dict, empty_dict, list, 1);
26890  if (!module) {
26891  if (!PyErr_ExceptionMatches(PyExc_ImportError))
26892  goto bad;
26893  PyErr_Clear();
26894  }
26895  }
26896  level = 0;
26897  }
26898  #endif
26899  if (!module) {
26900  #if PY_MAJOR_VERSION < 3
26901  PyObject *py_level = PyInt_FromLong(level);
26902  if (!py_level)
26903  goto bad;
26904  module = PyObject_CallFunctionObjArgs(py_import,
26905  name, global_dict, empty_dict, list, py_level, NULL);
26906  Py_DECREF(py_level);
26907  #else
26908  module = PyImport_ImportModuleLevelObject(
26909  name, global_dict, empty_dict, list, level);
26910  #endif
26911  }
26912  }
26913 bad:
26914  #if PY_MAJOR_VERSION < 3
26915  Py_XDECREF(py_import);
26916  #endif
26917  Py_XDECREF(empty_list);
26918  Py_XDECREF(empty_dict);
26919  return module;
26920 }
26921 
26922 /* CLineInTraceback */
26923  #ifndef CYTHON_CLINE_IN_TRACEBACK
26924 static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
26925  PyObject *use_cline;
26926  PyObject *ptype, *pvalue, *ptraceback;
26927 #if CYTHON_COMPILING_IN_CPYTHON
26928  PyObject **cython_runtime_dict;
26929 #endif
26930  if (unlikely(!__pyx_cython_runtime)) {
26931  return c_line;
26932  }
26933  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
26934 #if CYTHON_COMPILING_IN_CPYTHON
26935  cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
26936  if (likely(cython_runtime_dict)) {
26937  use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback);
26938  } else
26939 #endif
26940  {
26941  PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
26942  if (use_cline_obj) {
26943  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
26944  Py_DECREF(use_cline_obj);
26945  } else {
26946  PyErr_Clear();
26947  use_cline = NULL;
26948  }
26949  }
26950  if (!use_cline) {
26951  c_line = 0;
26952  PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
26953  }
26954  else if (PyObject_Not(use_cline) != 0) {
26955  c_line = 0;
26956  }
26957  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
26958  return c_line;
26959 }
26960 #endif
26961 
26962 /* CodeObjectCache */
26963  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
26964  int start = 0, mid = 0, end = count - 1;
26965  if (end >= 0 && code_line > entries[end].code_line) {
26966  return count;
26967  }
26968  while (start < end) {
26969  mid = start + (end - start) / 2;
26970  if (code_line < entries[mid].code_line) {
26971  end = mid;
26972  } else if (code_line > entries[mid].code_line) {
26973  start = mid + 1;
26974  } else {
26975  return mid;
26976  }
26977  }
26978  if (code_line <= entries[mid].code_line) {
26979  return mid;
26980  } else {
26981  return mid + 1;
26982  }
26983 }
26984 static PyCodeObject *__pyx_find_code_object(int code_line) {
26985  PyCodeObject* code_object;
26986  int pos;
26987  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
26988  return NULL;
26989  }
26990  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
26991  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
26992  return NULL;
26993  }
26994  code_object = __pyx_code_cache.entries[pos].code_object;
26995  Py_INCREF(code_object);
26996  return code_object;
26997 }
26998 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
26999  int pos, i;
27000  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
27001  if (unlikely(!code_line)) {
27002  return;
27003  }
27004  if (unlikely(!entries)) {
27005  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
27006  if (likely(entries)) {
27007  __pyx_code_cache.entries = entries;
27008  __pyx_code_cache.max_count = 64;
27009  __pyx_code_cache.count = 1;
27010  entries[0].code_line = code_line;
27011  entries[0].code_object = code_object;
27012  Py_INCREF(code_object);
27013  }
27014  return;
27015  }
27016  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
27017  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
27018  PyCodeObject* tmp = entries[pos].code_object;
27019  entries[pos].code_object = code_object;
27020  Py_DECREF(tmp);
27021  return;
27022  }
27023  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
27024  int new_max = __pyx_code_cache.max_count + 64;
27025  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
27026  __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
27027  if (unlikely(!entries)) {
27028  return;
27029  }
27030  __pyx_code_cache.entries = entries;
27031  __pyx_code_cache.max_count = new_max;
27032  }
27033  for (i=__pyx_code_cache.count; i>pos; i--) {
27034  entries[i] = entries[i-1];
27035  }
27036  entries[pos].code_line = code_line;
27037  entries[pos].code_object = code_object;
27038  __pyx_code_cache.count++;
27039  Py_INCREF(code_object);
27040 }
27041 
27042 /* AddTraceback */
27043  #include "compile.h"
27044 #include "frameobject.h"
27045 #include "traceback.h"
27046 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
27047  const char *funcname, int c_line,
27048  int py_line, const char *filename) {
27049  PyCodeObject *py_code = 0;
27050  PyObject *py_srcfile = 0;
27051  PyObject *py_funcname = 0;
27052  #if PY_MAJOR_VERSION < 3
27053  py_srcfile = PyString_FromString(filename);
27054  #else
27055  py_srcfile = PyUnicode_FromString(filename);
27056  #endif
27057  if (!py_srcfile) goto bad;
27058  if (c_line) {
27059  #if PY_MAJOR_VERSION < 3
27060  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
27061  #else
27062  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
27063  #endif
27064  }
27065  else {
27066  #if PY_MAJOR_VERSION < 3
27067  py_funcname = PyString_FromString(funcname);
27068  #else
27069  py_funcname = PyUnicode_FromString(funcname);
27070  #endif
27071  }
27072  if (!py_funcname) goto bad;
27073  py_code = __Pyx_PyCode_New(
27074  0,
27075  0,
27076  0,
27077  0,
27078  0,
27079  __pyx_empty_bytes, /*PyObject *code,*/
27080  __pyx_empty_tuple, /*PyObject *consts,*/
27081  __pyx_empty_tuple, /*PyObject *names,*/
27082  __pyx_empty_tuple, /*PyObject *varnames,*/
27083  __pyx_empty_tuple, /*PyObject *freevars,*/
27084  __pyx_empty_tuple, /*PyObject *cellvars,*/
27085  py_srcfile, /*PyObject *filename,*/
27086  py_funcname, /*PyObject *name,*/
27087  py_line,
27088  __pyx_empty_bytes /*PyObject *lnotab*/
27089  );
27090  Py_DECREF(py_srcfile);
27091  Py_DECREF(py_funcname);
27092  return py_code;
27093 bad:
27094  Py_XDECREF(py_srcfile);
27095  Py_XDECREF(py_funcname);
27096  return NULL;
27097 }
27098 static void __Pyx_AddTraceback(const char *funcname, int c_line,
27099  int py_line, const char *filename) {
27100  PyCodeObject *py_code = 0;
27101  PyFrameObject *py_frame = 0;
27102  PyThreadState *tstate = __Pyx_PyThreadState_Current;
27103  if (c_line) {
27104  c_line = __Pyx_CLineForTraceback(tstate, c_line);
27105  }
27106  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
27107  if (!py_code) {
27108  py_code = __Pyx_CreateCodeObjectForTraceback(
27109  funcname, c_line, py_line, filename);
27110  if (!py_code) goto bad;
27111  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
27112  }
27113  py_frame = PyFrame_New(
27114  tstate, /*PyThreadState *tstate,*/
27115  py_code, /*PyCodeObject *code,*/
27116  __pyx_d, /*PyObject *globals,*/
27117  0 /*PyObject *locals*/
27118  );
27119  if (!py_frame) goto bad;
27120  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
27121  PyTraceBack_Here(py_frame);
27122 bad:
27123  Py_XDECREF(py_code);
27124  Py_XDECREF(py_frame);
27125 }
27126 
27127 #if PY_MAJOR_VERSION < 3
27128 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
27129  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
27130  if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
27131  PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
27132  return -1;
27133 }
27134 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
27135  PyObject *obj = view->obj;
27136  if (!obj) return;
27137  if (PyObject_CheckBuffer(obj)) {
27138  PyBuffer_Release(view);
27139  return;
27140  }
27141  if ((0)) {}
27142  else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
27143  view->obj = NULL;
27144  Py_DECREF(obj);
27145 }
27146 #endif
27147 
27148 
27149  /* CIntFromPyVerify */
27150  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
27151  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
27152 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
27153  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
27154 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
27155  {\
27156  func_type value = func_value;\
27157  if (sizeof(target_type) < sizeof(func_type)) {\
27158  if (unlikely(value != (func_type) (target_type) value)) {\
27159  func_type zero = 0;\
27160  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
27161  return (target_type) -1;\
27162  if (is_unsigned && unlikely(value < zero))\
27163  goto raise_neg_overflow;\
27164  else\
27165  goto raise_overflow;\
27166  }\
27167  }\
27168  return (target_type) value;\
27169  }
27170 
27171 /* CIntToPy */
27172  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
27173  const int neg_one = (int) -1, const_zero = (int) 0;
27174  const int is_unsigned = neg_one > const_zero;
27175  if (is_unsigned) {
27176  if (sizeof(int) < sizeof(long)) {
27177  return PyInt_FromLong((long) value);
27178  } else if (sizeof(int) <= sizeof(unsigned long)) {
27179  return PyLong_FromUnsignedLong((unsigned long) value);
27180 #ifdef HAVE_LONG_LONG
27181  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
27182  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27183 #endif
27184  }
27185  } else {
27186  if (sizeof(int) <= sizeof(long)) {
27187  return PyInt_FromLong((long) value);
27188 #ifdef HAVE_LONG_LONG
27189  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
27190  return PyLong_FromLongLong((PY_LONG_LONG) value);
27191 #endif
27192  }
27193  }
27194  {
27195  int one = 1; int little = (int)*(unsigned char *)&one;
27196  unsigned char *bytes = (unsigned char *)&value;
27197  return _PyLong_FromByteArray(bytes, sizeof(int),
27198  little, !is_unsigned);
27199  }
27200 }
27201 
27202 /* CIntToPy */
27203  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
27204  const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
27205  const int is_unsigned = neg_one > const_zero;
27206  if (is_unsigned) {
27207  if (sizeof(Py_intptr_t) < sizeof(long)) {
27208  return PyInt_FromLong((long) value);
27209  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
27210  return PyLong_FromUnsignedLong((unsigned long) value);
27211 #ifdef HAVE_LONG_LONG
27212  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
27213  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27214 #endif
27215  }
27216  } else {
27217  if (sizeof(Py_intptr_t) <= sizeof(long)) {
27218  return PyInt_FromLong((long) value);
27219 #ifdef HAVE_LONG_LONG
27220  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
27221  return PyLong_FromLongLong((PY_LONG_LONG) value);
27222 #endif
27223  }
27224  }
27225  {
27226  int one = 1; int little = (int)*(unsigned char *)&one;
27227  unsigned char *bytes = (unsigned char *)&value;
27228  return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
27229  little, !is_unsigned);
27230  }
27231 }
27232 
27233 /* CIntToPy */
27234  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
27235  const long neg_one = (long) -1, const_zero = (long) 0;
27236  const int is_unsigned = neg_one > const_zero;
27237  if (is_unsigned) {
27238  if (sizeof(long) < sizeof(long)) {
27239  return PyInt_FromLong((long) value);
27240  } else if (sizeof(long) <= sizeof(unsigned long)) {
27241  return PyLong_FromUnsignedLong((unsigned long) value);
27242 #ifdef HAVE_LONG_LONG
27243  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
27244  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27245 #endif
27246  }
27247  } else {
27248  if (sizeof(long) <= sizeof(long)) {
27249  return PyInt_FromLong((long) value);
27250 #ifdef HAVE_LONG_LONG
27251  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
27252  return PyLong_FromLongLong((PY_LONG_LONG) value);
27253 #endif
27254  }
27255  }
27256  {
27257  int one = 1; int little = (int)*(unsigned char *)&one;
27258  unsigned char *bytes = (unsigned char *)&value;
27259  return _PyLong_FromByteArray(bytes, sizeof(long),
27260  little, !is_unsigned);
27261  }
27262 }
27263 
27264 /* Declarations */
27265  #if CYTHON_CCOMPLEX
27266  #ifdef __cplusplus
27267  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
27268  return ::std::complex< float >(x, y);
27269  }
27270  #else
27271  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
27272  return x + y*(__pyx_t_float_complex)_Complex_I;
27273  }
27274  #endif
27275 #else
27276  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
27277  __pyx_t_float_complex z;
27278  z.real = x;
27279  z.imag = y;
27280  return z;
27281  }
27282 #endif
27283 
27284 /* Arithmetic */
27285  #if CYTHON_CCOMPLEX
27286 #else
27287  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27288  return (a.real == b.real) && (a.imag == b.imag);
27289  }
27290  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27291  __pyx_t_float_complex z;
27292  z.real = a.real + b.real;
27293  z.imag = a.imag + b.imag;
27294  return z;
27295  }
27296  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27297  __pyx_t_float_complex z;
27298  z.real = a.real - b.real;
27299  z.imag = a.imag - b.imag;
27300  return z;
27301  }
27302  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27303  __pyx_t_float_complex z;
27304  z.real = a.real * b.real - a.imag * b.imag;
27305  z.imag = a.real * b.imag + a.imag * b.real;
27306  return z;
27307  }
27308  #if 1
27309  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27310  if (b.imag == 0) {
27311  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27312  } else if (fabsf(b.real) >= fabsf(b.imag)) {
27313  if (b.real == 0 && b.imag == 0) {
27314  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
27315  } else {
27316  float r = b.imag / b.real;
27317  float s = 1.0 / (b.real + b.imag * r);
27318  return __pyx_t_float_complex_from_parts(
27319  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
27320  }
27321  } else {
27322  float r = b.real / b.imag;
27323  float s = 1.0 / (b.imag + b.real * r);
27324  return __pyx_t_float_complex_from_parts(
27325  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
27326  }
27327  }
27328  #else
27329  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27330  if (b.imag == 0) {
27331  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27332  } else {
27333  float denom = b.real * b.real + b.imag * b.imag;
27334  return __pyx_t_float_complex_from_parts(
27335  (a.real * b.real + a.imag * b.imag) / denom,
27336  (a.imag * b.real - a.real * b.imag) / denom);
27337  }
27338  }
27339  #endif
27340  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
27341  __pyx_t_float_complex z;
27342  z.real = -a.real;
27343  z.imag = -a.imag;
27344  return z;
27345  }
27346  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
27347  return (a.real == 0) && (a.imag == 0);
27348  }
27349  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
27350  __pyx_t_float_complex z;
27351  z.real = a.real;
27352  z.imag = -a.imag;
27353  return z;
27354  }
27355  #if 1
27356  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
27357  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
27358  return sqrtf(z.real*z.real + z.imag*z.imag);
27359  #else
27360  return hypotf(z.real, z.imag);
27361  #endif
27362  }
27363  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27364  __pyx_t_float_complex z;
27365  float r, lnr, theta, z_r, z_theta;
27366  if (b.imag == 0 && b.real == (int)b.real) {
27367  if (b.real < 0) {
27368  float denom = a.real * a.real + a.imag * a.imag;
27369  a.real = a.real / denom;
27370  a.imag = -a.imag / denom;
27371  b.real = -b.real;
27372  }
27373  switch ((int)b.real) {
27374  case 0:
27375  z.real = 1;
27376  z.imag = 0;
27377  return z;
27378  case 1:
27379  return a;
27380  case 2:
27381  z = __Pyx_c_prod_float(a, a);
27382  return __Pyx_c_prod_float(a, a);
27383  case 3:
27384  z = __Pyx_c_prod_float(a, a);
27385  return __Pyx_c_prod_float(z, a);
27386  case 4:
27387  z = __Pyx_c_prod_float(a, a);
27388  return __Pyx_c_prod_float(z, z);
27389  }
27390  }
27391  if (a.imag == 0) {
27392  if (a.real == 0) {
27393  return a;
27394  } else if (b.imag == 0) {
27395  z.real = powf(a.real, b.real);
27396  z.imag = 0;
27397  return z;
27398  } else if (a.real > 0) {
27399  r = a.real;
27400  theta = 0;
27401  } else {
27402  r = -a.real;
27403  theta = atan2f(0, -1);
27404  }
27405  } else {
27406  r = __Pyx_c_abs_float(a);
27407  theta = atan2f(a.imag, a.real);
27408  }
27409  lnr = logf(r);
27410  z_r = expf(lnr * b.real - theta * b.imag);
27411  z_theta = theta * b.real + lnr * b.imag;
27412  z.real = z_r * cosf(z_theta);
27413  z.imag = z_r * sinf(z_theta);
27414  return z;
27415  }
27416  #endif
27417 #endif
27418 
27419 /* Declarations */
27420  #if CYTHON_CCOMPLEX
27421  #ifdef __cplusplus
27422  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
27423  return ::std::complex< double >(x, y);
27424  }
27425  #else
27426  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
27427  return x + y*(__pyx_t_double_complex)_Complex_I;
27428  }
27429  #endif
27430 #else
27431  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
27432  __pyx_t_double_complex z;
27433  z.real = x;
27434  z.imag = y;
27435  return z;
27436  }
27437 #endif
27438 
27439 /* Arithmetic */
27440  #if CYTHON_CCOMPLEX
27441 #else
27442  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27443  return (a.real == b.real) && (a.imag == b.imag);
27444  }
27445  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27446  __pyx_t_double_complex z;
27447  z.real = a.real + b.real;
27448  z.imag = a.imag + b.imag;
27449  return z;
27450  }
27451  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27452  __pyx_t_double_complex z;
27453  z.real = a.real - b.real;
27454  z.imag = a.imag - b.imag;
27455  return z;
27456  }
27457  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27458  __pyx_t_double_complex z;
27459  z.real = a.real * b.real - a.imag * b.imag;
27460  z.imag = a.real * b.imag + a.imag * b.real;
27461  return z;
27462  }
27463  #if 1
27464  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27465  if (b.imag == 0) {
27466  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27467  } else if (fabs(b.real) >= fabs(b.imag)) {
27468  if (b.real == 0 && b.imag == 0) {
27469  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
27470  } else {
27471  double r = b.imag / b.real;
27472  double s = 1.0 / (b.real + b.imag * r);
27473  return __pyx_t_double_complex_from_parts(
27474  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
27475  }
27476  } else {
27477  double r = b.real / b.imag;
27478  double s = 1.0 / (b.imag + b.real * r);
27479  return __pyx_t_double_complex_from_parts(
27480  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
27481  }
27482  }
27483  #else
27484  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27485  if (b.imag == 0) {
27486  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27487  } else {
27488  double denom = b.real * b.real + b.imag * b.imag;
27489  return __pyx_t_double_complex_from_parts(
27490  (a.real * b.real + a.imag * b.imag) / denom,
27491  (a.imag * b.real - a.real * b.imag) / denom);
27492  }
27493  }
27494  #endif
27495  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
27496  __pyx_t_double_complex z;
27497  z.real = -a.real;
27498  z.imag = -a.imag;
27499  return z;
27500  }
27501  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
27502  return (a.real == 0) && (a.imag == 0);
27503  }
27504  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
27505  __pyx_t_double_complex z;
27506  z.real = a.real;
27507  z.imag = -a.imag;
27508  return z;
27509  }
27510  #if 1
27511  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
27512  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
27513  return sqrt(z.real*z.real + z.imag*z.imag);
27514  #else
27515  return hypot(z.real, z.imag);
27516  #endif
27517  }
27518  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27519  __pyx_t_double_complex z;
27520  double r, lnr, theta, z_r, z_theta;
27521  if (b.imag == 0 && b.real == (int)b.real) {
27522  if (b.real < 0) {
27523  double denom = a.real * a.real + a.imag * a.imag;
27524  a.real = a.real / denom;
27525  a.imag = -a.imag / denom;
27526  b.real = -b.real;
27527  }
27528  switch ((int)b.real) {
27529  case 0:
27530  z.real = 1;
27531  z.imag = 0;
27532  return z;
27533  case 1:
27534  return a;
27535  case 2:
27536  z = __Pyx_c_prod_double(a, a);
27537  return __Pyx_c_prod_double(a, a);
27538  case 3:
27539  z = __Pyx_c_prod_double(a, a);
27540  return __Pyx_c_prod_double(z, a);
27541  case 4:
27542  z = __Pyx_c_prod_double(a, a);
27543  return __Pyx_c_prod_double(z, z);
27544  }
27545  }
27546  if (a.imag == 0) {
27547  if (a.real == 0) {
27548  return a;
27549  } else if (b.imag == 0) {
27550  z.real = pow(a.real, b.real);
27551  z.imag = 0;
27552  return z;
27553  } else if (a.real > 0) {
27554  r = a.real;
27555  theta = 0;
27556  } else {
27557  r = -a.real;
27558  theta = atan2(0, -1);
27559  }
27560  } else {
27561  r = __Pyx_c_abs_double(a);
27562  theta = atan2(a.imag, a.real);
27563  }
27564  lnr = log(r);
27565  z_r = exp(lnr * b.real - theta * b.imag);
27566  z_theta = theta * b.real + lnr * b.imag;
27567  z.real = z_r * cos(z_theta);
27568  z.imag = z_r * sin(z_theta);
27569  return z;
27570  }
27571  #endif
27572 #endif
27573 
27574 /* CIntToPy */
27575  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
27576  const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
27577  const int is_unsigned = neg_one > const_zero;
27578  if (is_unsigned) {
27579  if (sizeof(enum NPY_TYPES) < sizeof(long)) {
27580  return PyInt_FromLong((long) value);
27581  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
27582  return PyLong_FromUnsignedLong((unsigned long) value);
27583 #ifdef HAVE_LONG_LONG
27584  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
27585  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27586 #endif
27587  }
27588  } else {
27589  if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
27590  return PyInt_FromLong((long) value);
27591 #ifdef HAVE_LONG_LONG
27592  } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
27593  return PyLong_FromLongLong((PY_LONG_LONG) value);
27594 #endif
27595  }
27596  }
27597  {
27598  int one = 1; int little = (int)*(unsigned char *)&one;
27599  unsigned char *bytes = (unsigned char *)&value;
27600  return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
27601  little, !is_unsigned);
27602  }
27603 }
27604 
27605 /* CIntFromPy */
27606  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
27607  const int neg_one = (int) -1, const_zero = (int) 0;
27608  const int is_unsigned = neg_one > const_zero;
27609 #if PY_MAJOR_VERSION < 3
27610  if (likely(PyInt_Check(x))) {
27611  if (sizeof(int) < sizeof(long)) {
27612  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
27613  } else {
27614  long val = PyInt_AS_LONG(x);
27615  if (is_unsigned && unlikely(val < 0)) {
27616  goto raise_neg_overflow;
27617  }
27618  return (int) val;
27619  }
27620  } else
27621 #endif
27622  if (likely(PyLong_Check(x))) {
27623  if (is_unsigned) {
27624 #if CYTHON_USE_PYLONG_INTERNALS
27625  const digit* digits = ((PyLongObject*)x)->ob_digit;
27626  switch (Py_SIZE(x)) {
27627  case 0: return (int) 0;
27628  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
27629  case 2:
27630  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
27631  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27632  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27633  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
27634  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27635  }
27636  }
27637  break;
27638  case 3:
27639  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
27640  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27641  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27642  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
27643  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27644  }
27645  }
27646  break;
27647  case 4:
27648  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
27649  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27650  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27651  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
27652  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27653  }
27654  }
27655  break;
27656  }
27657 #endif
27658 #if CYTHON_COMPILING_IN_CPYTHON
27659  if (unlikely(Py_SIZE(x) < 0)) {
27660  goto raise_neg_overflow;
27661  }
27662 #else
27663  {
27664  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27665  if (unlikely(result < 0))
27666  return (int) -1;
27667  if (unlikely(result == 1))
27668  goto raise_neg_overflow;
27669  }
27670 #endif
27671  if (sizeof(int) <= sizeof(unsigned long)) {
27672  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
27673 #ifdef HAVE_LONG_LONG
27674  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
27675  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27676 #endif
27677  }
27678  } else {
27679 #if CYTHON_USE_PYLONG_INTERNALS
27680  const digit* digits = ((PyLongObject*)x)->ob_digit;
27681  switch (Py_SIZE(x)) {
27682  case 0: return (int) 0;
27683  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
27684  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
27685  case -2:
27686  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
27687  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27688  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27689  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
27690  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27691  }
27692  }
27693  break;
27694  case 2:
27695  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
27696  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27697  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27698  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
27699  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27700  }
27701  }
27702  break;
27703  case -3:
27704  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
27705  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27706  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27707  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
27708  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27709  }
27710  }
27711  break;
27712  case 3:
27713  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
27714  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27715  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27716  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
27717  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27718  }
27719  }
27720  break;
27721  case -4:
27722  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
27723  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27724  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27725  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
27726  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27727  }
27728  }
27729  break;
27730  case 4:
27731  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
27732  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27733  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27734  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
27735  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27736  }
27737  }
27738  break;
27739  }
27740 #endif
27741  if (sizeof(int) <= sizeof(long)) {
27742  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
27743 #ifdef HAVE_LONG_LONG
27744  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
27745  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
27746 #endif
27747  }
27748  }
27749  {
27750 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27751  PyErr_SetString(PyExc_RuntimeError,
27752  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27753 #else
27754  int val;
27755  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27756  #if PY_MAJOR_VERSION < 3
27757  if (likely(v) && !PyLong_Check(v)) {
27758  PyObject *tmp = v;
27759  v = PyNumber_Long(tmp);
27760  Py_DECREF(tmp);
27761  }
27762  #endif
27763  if (likely(v)) {
27764  int one = 1; int is_little = (int)*(unsigned char *)&one;
27765  unsigned char *bytes = (unsigned char *)&val;
27766  int ret = _PyLong_AsByteArray((PyLongObject *)v,
27767  bytes, sizeof(val),
27768  is_little, !is_unsigned);
27769  Py_DECREF(v);
27770  if (likely(!ret))
27771  return val;
27772  }
27773 #endif
27774  return (int) -1;
27775  }
27776  } else {
27777  int val;
27778  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27779  if (!tmp) return (int) -1;
27780  val = __Pyx_PyInt_As_int(tmp);
27781  Py_DECREF(tmp);
27782  return val;
27783  }
27784 raise_overflow:
27785  PyErr_SetString(PyExc_OverflowError,
27786  "value too large to convert to int");
27787  return (int) -1;
27788 raise_neg_overflow:
27789  PyErr_SetString(PyExc_OverflowError,
27790  "can't convert negative value to int");
27791  return (int) -1;
27792 }
27793 
27794 /* CIntFromPy */
27795  static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) {
27796  const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
27797  const int is_unsigned = neg_one > const_zero;
27798 #if PY_MAJOR_VERSION < 3
27799  if (likely(PyInt_Check(x))) {
27800  if (sizeof(Py_intptr_t) < sizeof(long)) {
27801  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x))
27802  } else {
27803  long val = PyInt_AS_LONG(x);
27804  if (is_unsigned && unlikely(val < 0)) {
27805  goto raise_neg_overflow;
27806  }
27807  return (Py_intptr_t) val;
27808  }
27809  } else
27810 #endif
27811  if (likely(PyLong_Check(x))) {
27812  if (is_unsigned) {
27813 #if CYTHON_USE_PYLONG_INTERNALS
27814  const digit* digits = ((PyLongObject*)x)->ob_digit;
27815  switch (Py_SIZE(x)) {
27816  case 0: return (Py_intptr_t) 0;
27817  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, digits[0])
27818  case 2:
27819  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
27820  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27821  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27822  } else if (8 * sizeof(Py_intptr_t) >= 2 * PyLong_SHIFT) {
27823  return (Py_intptr_t) (((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
27824  }
27825  }
27826  break;
27827  case 3:
27828  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
27829  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27830  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27831  } else if (8 * sizeof(Py_intptr_t) >= 3 * PyLong_SHIFT) {
27832  return (Py_intptr_t) (((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
27833  }
27834  }
27835  break;
27836  case 4:
27837  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
27838  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27839  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27840  } else if (8 * sizeof(Py_intptr_t) >= 4 * PyLong_SHIFT) {
27841  return (Py_intptr_t) (((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
27842  }
27843  }
27844  break;
27845  }
27846 #endif
27847 #if CYTHON_COMPILING_IN_CPYTHON
27848  if (unlikely(Py_SIZE(x) < 0)) {
27849  goto raise_neg_overflow;
27850  }
27851 #else
27852  {
27853  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27854  if (unlikely(result < 0))
27855  return (Py_intptr_t) -1;
27856  if (unlikely(result == 1))
27857  goto raise_neg_overflow;
27858  }
27859 #endif
27860  if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
27861  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x))
27862 #ifdef HAVE_LONG_LONG
27863  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
27864  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27865 #endif
27866  }
27867  } else {
27868 #if CYTHON_USE_PYLONG_INTERNALS
27869  const digit* digits = ((PyLongObject*)x)->ob_digit;
27870  switch (Py_SIZE(x)) {
27871  case 0: return (Py_intptr_t) 0;
27872  case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, (sdigit) (-(sdigit)digits[0]))
27873  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, +digits[0])
27874  case -2:
27875  if (8 * sizeof(Py_intptr_t) - 1 > 1 * PyLong_SHIFT) {
27876  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27877  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27878  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
27879  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27880  }
27881  }
27882  break;
27883  case 2:
27884  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
27885  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27886  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27887  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
27888  return (Py_intptr_t) ((((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27889  }
27890  }
27891  break;
27892  case -3:
27893  if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
27894  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27895  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27896  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
27897  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27898  }
27899  }
27900  break;
27901  case 3:
27902  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
27903  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27904  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27905  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
27906  return (Py_intptr_t) ((((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27907  }
27908  }
27909  break;
27910  case -4:
27911  if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
27912  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27913  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27914  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
27915  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27916  }
27917  }
27918  break;
27919  case 4:
27920  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
27921  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27922  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27923  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
27924  return (Py_intptr_t) ((((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
27925  }
27926  }
27927  break;
27928  }
27929 #endif
27930  if (sizeof(Py_intptr_t) <= sizeof(long)) {
27931  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, long, PyLong_AsLong(x))
27932 #ifdef HAVE_LONG_LONG
27933  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
27934  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, PY_LONG_LONG, PyLong_AsLongLong(x))
27935 #endif
27936  }
27937  }
27938  {
27939 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27940  PyErr_SetString(PyExc_RuntimeError,
27941  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27942 #else
27943  Py_intptr_t val;
27944  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27945  #if PY_MAJOR_VERSION < 3
27946  if (likely(v) && !PyLong_Check(v)) {
27947  PyObject *tmp = v;
27948  v = PyNumber_Long(tmp);
27949  Py_DECREF(tmp);
27950  }
27951  #endif
27952  if (likely(v)) {
27953  int one = 1; int is_little = (int)*(unsigned char *)&one;
27954  unsigned char *bytes = (unsigned char *)&val;
27955  int ret = _PyLong_AsByteArray((PyLongObject *)v,
27956  bytes, sizeof(val),
27957  is_little, !is_unsigned);
27958  Py_DECREF(v);
27959  if (likely(!ret))
27960  return val;
27961  }
27962 #endif
27963  return (Py_intptr_t) -1;
27964  }
27965  } else {
27966  Py_intptr_t val;
27967  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27968  if (!tmp) return (Py_intptr_t) -1;
27969  val = __Pyx_PyInt_As_Py_intptr_t(tmp);
27970  Py_DECREF(tmp);
27971  return val;
27972  }
27973 raise_overflow:
27974  PyErr_SetString(PyExc_OverflowError,
27975  "value too large to convert to Py_intptr_t");
27976  return (Py_intptr_t) -1;
27977 raise_neg_overflow:
27978  PyErr_SetString(PyExc_OverflowError,
27979  "can't convert negative value to Py_intptr_t");
27980  return (Py_intptr_t) -1;
27981 }
27982 
27983 /* CIntFromPy */
27984  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
27985  const long neg_one = (long) -1, const_zero = (long) 0;
27986  const int is_unsigned = neg_one > const_zero;
27987 #if PY_MAJOR_VERSION < 3
27988  if (likely(PyInt_Check(x))) {
27989  if (sizeof(long) < sizeof(long)) {
27990  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
27991  } else {
27992  long val = PyInt_AS_LONG(x);
27993  if (is_unsigned && unlikely(val < 0)) {
27994  goto raise_neg_overflow;
27995  }
27996  return (long) val;
27997  }
27998  } else
27999 #endif
28000  if (likely(PyLong_Check(x))) {
28001  if (is_unsigned) {
28002 #if CYTHON_USE_PYLONG_INTERNALS
28003  const digit* digits = ((PyLongObject*)x)->ob_digit;
28004  switch (Py_SIZE(x)) {
28005  case 0: return (long) 0;
28006  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
28007  case 2:
28008  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
28009  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28010  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28011  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
28012  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
28013  }
28014  }
28015  break;
28016  case 3:
28017  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
28018  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28019  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28020  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
28021  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
28022  }
28023  }
28024  break;
28025  case 4:
28026  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
28027  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28028  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28029  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
28030  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
28031  }
28032  }
28033  break;
28034  }
28035 #endif
28036 #if CYTHON_COMPILING_IN_CPYTHON
28037  if (unlikely(Py_SIZE(x) < 0)) {
28038  goto raise_neg_overflow;
28039  }
28040 #else
28041  {
28042  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28043  if (unlikely(result < 0))
28044  return (long) -1;
28045  if (unlikely(result == 1))
28046  goto raise_neg_overflow;
28047  }
28048 #endif
28049  if (sizeof(long) <= sizeof(unsigned long)) {
28050  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
28051 #ifdef HAVE_LONG_LONG
28052  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
28053  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28054 #endif
28055  }
28056  } else {
28057 #if CYTHON_USE_PYLONG_INTERNALS
28058  const digit* digits = ((PyLongObject*)x)->ob_digit;
28059  switch (Py_SIZE(x)) {
28060  case 0: return (long) 0;
28061  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
28062  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
28063  case -2:
28064  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
28065  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28066  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28067  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
28068  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28069  }
28070  }
28071  break;
28072  case 2:
28073  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
28074  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28075  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28076  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
28077  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28078  }
28079  }
28080  break;
28081  case -3:
28082  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
28083  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28084  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28085  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
28086  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28087  }
28088  }
28089  break;
28090  case 3:
28091  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
28092  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28093  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28094  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
28095  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28096  }
28097  }
28098  break;
28099  case -4:
28100  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
28101  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28102  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28103  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
28104  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28105  }
28106  }
28107  break;
28108  case 4:
28109  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
28110  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28111  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28112  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
28113  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28114  }
28115  }
28116  break;
28117  }
28118 #endif
28119  if (sizeof(long) <= sizeof(long)) {
28120  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
28121 #ifdef HAVE_LONG_LONG
28122  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
28123  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
28124 #endif
28125  }
28126  }
28127  {
28128 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28129  PyErr_SetString(PyExc_RuntimeError,
28130  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28131 #else
28132  long val;
28133  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
28134  #if PY_MAJOR_VERSION < 3
28135  if (likely(v) && !PyLong_Check(v)) {
28136  PyObject *tmp = v;
28137  v = PyNumber_Long(tmp);
28138  Py_DECREF(tmp);
28139  }
28140  #endif
28141  if (likely(v)) {
28142  int one = 1; int is_little = (int)*(unsigned char *)&one;
28143  unsigned char *bytes = (unsigned char *)&val;
28144  int ret = _PyLong_AsByteArray((PyLongObject *)v,
28145  bytes, sizeof(val),
28146  is_little, !is_unsigned);
28147  Py_DECREF(v);
28148  if (likely(!ret))
28149  return val;
28150  }
28151 #endif
28152  return (long) -1;
28153  }
28154  } else {
28155  long val;
28156  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28157  if (!tmp) return (long) -1;
28158  val = __Pyx_PyInt_As_long(tmp);
28159  Py_DECREF(tmp);
28160  return val;
28161  }
28162 raise_overflow:
28163  PyErr_SetString(PyExc_OverflowError,
28164  "value too large to convert to long");
28165  return (long) -1;
28166 raise_neg_overflow:
28167  PyErr_SetString(PyExc_OverflowError,
28168  "can't convert negative value to long");
28169  return (long) -1;
28170 }
28171 
28172 /* FastTypeChecks */
28173  #if CYTHON_COMPILING_IN_CPYTHON
28174 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
28175  while (a) {
28176  a = a->tp_base;
28177  if (a == b)
28178  return 1;
28179  }
28180  return b == &PyBaseObject_Type;
28181 }
28182 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
28183  PyObject *mro;
28184  if (a == b) return 1;
28185  mro = a->tp_mro;
28186  if (likely(mro)) {
28187  Py_ssize_t i, n;
28188  n = PyTuple_GET_SIZE(mro);
28189  for (i = 0; i < n; i++) {
28190  if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
28191  return 1;
28192  }
28193  return 0;
28194  }
28195  return __Pyx_InBases(a, b);
28196 }
28197 #if PY_MAJOR_VERSION == 2
28198 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
28199  PyObject *exception, *value, *tb;
28200  int res;
28201  __Pyx_PyThreadState_declare
28202  __Pyx_PyThreadState_assign
28203  __Pyx_ErrFetch(&exception, &value, &tb);
28204  res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
28205  if (unlikely(res == -1)) {
28206  PyErr_WriteUnraisable(err);
28207  res = 0;
28208  }
28209  if (!res) {
28210  res = PyObject_IsSubclass(err, exc_type2);
28211  if (unlikely(res == -1)) {
28212  PyErr_WriteUnraisable(err);
28213  res = 0;
28214  }
28215  }
28216  __Pyx_ErrRestore(exception, value, tb);
28217  return res;
28218 }
28219 #else
28220 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
28221  int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
28222  if (!res) {
28223  res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
28224  }
28225  return res;
28226 }
28227 #endif
28228 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
28229  Py_ssize_t i, n;
28230  assert(PyExceptionClass_Check(exc_type));
28231  n = PyTuple_GET_SIZE(tuple);
28232 #if PY_MAJOR_VERSION >= 3
28233  for (i=0; i<n; i++) {
28234  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
28235  }
28236 #endif
28237  for (i=0; i<n; i++) {
28238  PyObject *t = PyTuple_GET_ITEM(tuple, i);
28239  #if PY_MAJOR_VERSION < 3
28240  if (likely(exc_type == t)) return 1;
28241  #endif
28242  if (likely(PyExceptionClass_Check(t))) {
28243  if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
28244  } else {
28245  }
28246  }
28247  return 0;
28248 }
28249 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
28250  if (likely(err == exc_type)) return 1;
28251  if (likely(PyExceptionClass_Check(err))) {
28252  if (likely(PyExceptionClass_Check(exc_type))) {
28253  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
28254  } else if (likely(PyTuple_Check(exc_type))) {
28255  return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
28256  } else {
28257  }
28258  }
28259  return PyErr_GivenExceptionMatches(err, exc_type);
28260 }
28261 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
28262  assert(PyExceptionClass_Check(exc_type1));
28263  assert(PyExceptionClass_Check(exc_type2));
28264  if (likely(err == exc_type1 || err == exc_type2)) return 1;
28265  if (likely(PyExceptionClass_Check(err))) {
28266  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
28267  }
28268  return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
28269 }
28270 #endif
28271 
28272 /* CheckBinaryVersion */
28273  static int __Pyx_check_binary_version(void) {
28274  char ctversion[4], rtversion[4];
28275  PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
28276  PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
28277  if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
28278  char message[200];
28279  PyOS_snprintf(message, sizeof(message),
28280  "compiletime version %s of module '%.100s' "
28281  "does not match runtime version %s",
28282  ctversion, __Pyx_MODULE_NAME, rtversion);
28283  return PyErr_WarnEx(NULL, message, 1);
28284  }
28285  return 0;
28286 }
28287 
28288 /* ModuleImport */
28289  #ifndef __PYX_HAVE_RT_ImportModule
28290 #define __PYX_HAVE_RT_ImportModule
28291 static PyObject *__Pyx_ImportModule(const char *name) {
28292  PyObject *py_name = 0;
28293  PyObject *py_module = 0;
28294  py_name = __Pyx_PyIdentifier_FromString(name);
28295  if (!py_name)
28296  goto bad;
28297  py_module = PyImport_Import(py_name);
28298  Py_DECREF(py_name);
28299  return py_module;
28300 bad:
28301  Py_XDECREF(py_name);
28302  return 0;
28303 }
28304 #endif
28305 
28306 /* TypeImport */
28307  #ifndef __PYX_HAVE_RT_ImportType
28308 #define __PYX_HAVE_RT_ImportType
28309 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
28310  size_t size, int strict)
28311 {
28312  PyObject *py_module = 0;
28313  PyObject *result = 0;
28314  PyObject *py_name = 0;
28315  char warning[200];
28316  Py_ssize_t basicsize;
28317 #ifdef Py_LIMITED_API
28318  PyObject *py_basicsize;
28319 #endif
28320  py_module = __Pyx_ImportModule(module_name);
28321  if (!py_module)
28322  goto bad;
28323  py_name = __Pyx_PyIdentifier_FromString(class_name);
28324  if (!py_name)
28325  goto bad;
28326  result = PyObject_GetAttr(py_module, py_name);
28327  Py_DECREF(py_name);
28328  py_name = 0;
28329  Py_DECREF(py_module);
28330  py_module = 0;
28331  if (!result)
28332  goto bad;
28333  if (!PyType_Check(result)) {
28334  PyErr_Format(PyExc_TypeError,
28335  "%.200s.%.200s is not a type object",
28336  module_name, class_name);
28337  goto bad;
28338  }
28339 #ifndef Py_LIMITED_API
28340  basicsize = ((PyTypeObject *)result)->tp_basicsize;
28341 #else
28342  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
28343  if (!py_basicsize)
28344  goto bad;
28345  basicsize = PyLong_AsSsize_t(py_basicsize);
28346  Py_DECREF(py_basicsize);
28347  py_basicsize = 0;
28348  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
28349  goto bad;
28350 #endif
28351  if (!strict && (size_t)basicsize > size) {
28352  PyOS_snprintf(warning, sizeof(warning),
28353  "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
28354  module_name, class_name, basicsize, size);
28355  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
28356  }
28357  else if ((size_t)basicsize != size) {
28358  PyErr_Format(PyExc_ValueError,
28359  "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
28360  module_name, class_name, basicsize, size);
28361  goto bad;
28362  }
28363  return (PyTypeObject *)result;
28364 bad:
28365  Py_XDECREF(py_module);
28366  Py_XDECREF(result);
28367  return NULL;
28368 }
28369 #endif
28370 
28371 /* InitStrings */
28372  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
28373  while (t->p) {
28374  #if PY_MAJOR_VERSION < 3
28375  if (t->is_unicode) {
28376  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
28377  } else if (t->intern) {
28378  *t->p = PyString_InternFromString(t->s);
28379  } else {
28380  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
28381  }
28382  #else
28383  if (t->is_unicode | t->is_str) {
28384  if (t->intern) {
28385  *t->p = PyUnicode_InternFromString(t->s);
28386  } else if (t->encoding) {
28387  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
28388  } else {
28389  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
28390  }
28391  } else {
28392  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
28393  }
28394  #endif
28395  if (!*t->p)
28396  return -1;
28397  if (PyObject_Hash(*t->p) == -1)
28398  return -1;
28399  ++t;
28400  }
28401  return 0;
28402 }
28403 
28404 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
28405  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
28406 }
28407 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
28408  Py_ssize_t ignore;
28409  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
28410 }
28411 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
28412 #if !CYTHON_PEP393_ENABLED
28413 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28414  char* defenc_c;
28415  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
28416  if (!defenc) return NULL;
28417  defenc_c = PyBytes_AS_STRING(defenc);
28418 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28419  {
28420  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
28421  char* c;
28422  for (c = defenc_c; c < end; c++) {
28423  if ((unsigned char) (*c) >= 128) {
28424  PyUnicode_AsASCIIString(o);
28425  return NULL;
28426  }
28427  }
28428  }
28429 #endif
28430  *length = PyBytes_GET_SIZE(defenc);
28431  return defenc_c;
28432 }
28433 #else
28434 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28435  if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
28436 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28437  if (likely(PyUnicode_IS_ASCII(o))) {
28438  *length = PyUnicode_GET_LENGTH(o);
28439  return PyUnicode_AsUTF8(o);
28440  } else {
28441  PyUnicode_AsASCIIString(o);
28442  return NULL;
28443  }
28444 #else
28445  return PyUnicode_AsUTF8AndSize(o, length);
28446 #endif
28447 }
28448 #endif
28449 #endif
28450 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28451 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
28452  if (
28453 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28454  __Pyx_sys_getdefaultencoding_not_ascii &&
28455 #endif
28456  PyUnicode_Check(o)) {
28457  return __Pyx_PyUnicode_AsStringAndSize(o, length);
28458  } else
28459 #endif
28460 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
28461  if (PyByteArray_Check(o)) {
28462  *length = PyByteArray_GET_SIZE(o);
28463  return PyByteArray_AS_STRING(o);
28464  } else
28465 #endif
28466  {
28467  char* result;
28468  int r = PyBytes_AsStringAndSize(o, &result, length);
28469  if (unlikely(r < 0)) {
28470  return NULL;
28471  } else {
28472  return result;
28473  }
28474  }
28475 }
28476 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
28477  int is_true = x == Py_True;
28478  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
28479  else return PyObject_IsTrue(x);
28480 }
28481 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
28482 #if PY_MAJOR_VERSION >= 3
28483  if (PyLong_Check(result)) {
28484  if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
28485  "__int__ returned non-int (type %.200s). "
28486  "The ability to return an instance of a strict subclass of int "
28487  "is deprecated, and may be removed in a future version of Python.",
28488  Py_TYPE(result)->tp_name)) {
28489  Py_DECREF(result);
28490  return NULL;
28491  }
28492  return result;
28493  }
28494 #endif
28495  PyErr_Format(PyExc_TypeError,
28496  "__%.4s__ returned non-%.4s (type %.200s)",
28497  type_name, type_name, Py_TYPE(result)->tp_name);
28498  Py_DECREF(result);
28499  return NULL;
28500 }
28501 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
28502 #if CYTHON_USE_TYPE_SLOTS
28503  PyNumberMethods *m;
28504 #endif
28505  const char *name = NULL;
28506  PyObject *res = NULL;
28507 #if PY_MAJOR_VERSION < 3
28508  if (likely(PyInt_Check(x) || PyLong_Check(x)))
28509 #else
28510  if (likely(PyLong_Check(x)))
28511 #endif
28512  return __Pyx_NewRef(x);
28513 #if CYTHON_USE_TYPE_SLOTS
28514  m = Py_TYPE(x)->tp_as_number;
28515  #if PY_MAJOR_VERSION < 3
28516  if (m && m->nb_int) {
28517  name = "int";
28518  res = m->nb_int(x);
28519  }
28520  else if (m && m->nb_long) {
28521  name = "long";
28522  res = m->nb_long(x);
28523  }
28524  #else
28525  if (likely(m && m->nb_int)) {
28526  name = "int";
28527  res = m->nb_int(x);
28528  }
28529  #endif
28530 #else
28531  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
28532  res = PyNumber_Int(x);
28533  }
28534 #endif
28535  if (likely(res)) {
28536 #if PY_MAJOR_VERSION < 3
28537  if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
28538 #else
28539  if (unlikely(!PyLong_CheckExact(res))) {
28540 #endif
28541  return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
28542  }
28543  }
28544  else if (!PyErr_Occurred()) {
28545  PyErr_SetString(PyExc_TypeError,
28546  "an integer is required");
28547  }
28548  return res;
28549 }
28550 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
28551  Py_ssize_t ival;
28552  PyObject *x;
28553 #if PY_MAJOR_VERSION < 3
28554  if (likely(PyInt_CheckExact(b))) {
28555  if (sizeof(Py_ssize_t) >= sizeof(long))
28556  return PyInt_AS_LONG(b);
28557  else
28558  return PyInt_AsSsize_t(x);
28559  }
28560 #endif
28561  if (likely(PyLong_CheckExact(b))) {
28562  #if CYTHON_USE_PYLONG_INTERNALS
28563  const digit* digits = ((PyLongObject*)b)->ob_digit;
28564  const Py_ssize_t size = Py_SIZE(b);
28565  if (likely(__Pyx_sst_abs(size) <= 1)) {
28566  ival = likely(size) ? digits[0] : 0;
28567  if (size == -1) ival = -ival;
28568  return ival;
28569  } else {
28570  switch (size) {
28571  case 2:
28572  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28573  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28574  }
28575  break;
28576  case -2:
28577  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28578  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28579  }
28580  break;
28581  case 3:
28582  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28583  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28584  }
28585  break;
28586  case -3:
28587  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28588  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28589  }
28590  break;
28591  case 4:
28592  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28593  return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28594  }
28595  break;
28596  case -4:
28597  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28598  return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28599  }
28600  break;
28601  }
28602  }
28603  #endif
28604  return PyLong_AsSsize_t(b);
28605  }
28606  x = PyNumber_Index(b);
28607  if (!x) return -1;
28608  ival = PyInt_AsSsize_t(x);
28609  Py_DECREF(x);
28610  return ival;
28611 }
28612 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
28613  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
28614 }
28615 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
28616  return PyInt_FromSize_t(ival);
28617 }
28618 
28619 
28620 #endif /* Py_PYTHON_H */
f
Double f
Definition: Headers.h:64
number
Int number
Definition: Headers.h:33
s
Double s
Definition: Headers.h:84
n
Int n
Definition: Headers.h:28
v
Double v
Definition: Headers.h:95
T
Double T
Definition: Headers.h:87
z
Double * z
Definition: Headers.h:49
u
Double u
Definition: Headers.h:89
c
Double c
Definition: Headers.h:54
r
Double r
Definition: Headers.h:83
pos
double pos(double a)
Definition: testFMMandFSW.cpp:8